/* Generado desde base.html (2026-10-21): diseno comun del portal. Se guarda en el dispositivo. */
  :root {
    --navy-950: #0b1120; --navy-900: #0f172a; --navy-800: #1a2540; --navy-700: #24314f;
    --teal-500: #14b8a6; --teal-600: #0d9488; --teal-100: #ccfbf1;
    --indigo-600: #4f46e5; --indigo-50: #eef2ff;
    --bg: #f3f5fa; --card: #ffffff; --border: #e4e8f1; --border-soft: #edf0f7;
    --text: #1b2333; --text-muted: #6b7690; --text-faint: #97a1b8;
    --success: #16a34a; --success-bg: #eafaf0; --warning: #d97706; --warning-bg: #fff6e7;
    --danger: #dc2626; --danger-bg: #fdecea; --info: #2563eb; --info-bg: #eaf1ff;
    --radius: 12px; --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16,24,53,.04), 0 8px 24px -12px rgba(16,24,53,.12);
    --sidebar-w: 240px;
  }
  * { box-sizing: border-box; }
  /* Safari no hereda la letra en botones/cajas (salian con letra serif) */
  button, input, select, textarea { font-family: inherit; }
  html, body { height: 100%; }
  /* Base un poco mas grande que el default del navegador (16px) -- como casi
     todo el sistema de diseño esta en rem, esto agranda TODOS los textos
     proporcionalmente (titulos, tablas, botones, labels) en un solo lugar. */
  html { font-size: 16.5px; }  /* antes 17.5px; Carlos: a 100% se veia un poco grueso */
  body {
    margin: 0; background: var(--bg); color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
    font-weight: 370;  /* letra mas delgada (pedido de Carlos); Inter variable */
    -webkit-font-smoothing: antialiased;
  }
  a { color: var(--teal-600); }
  b, strong, th { font-weight: 560; }

  /* ---- Barra superior estilo Facebook (blanca) ---- */
  /* Fija SIEMPRE arriba (antes sticky: con html/body al 100% de alto se iba
     al bajar mas de una pantalla y quedaba el hueco vacio). */
  .fb-topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 30; background: var(--card); border-bottom: 1px solid var(--border); }
  .fb-topbar-inner { max-width: none; margin: 0; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 1.25rem; gap: .75rem; }
  .fb-brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.02rem; flex-shrink: 0; white-space: nowrap; }
  .fb-logo-img { height: 23px; width: auto; display: block; flex-shrink: 0; }
  .fb-brand-sub { font-weight: 600; font-size: .76rem; letter-spacing: .01em; color: var(--text-muted); }
  .fb-topbar-right { display: flex; align-items: center; gap: .7rem; flex-shrink: 0; }
  .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--indigo-50); color: var(--indigo-600); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: .82rem; }
  .user-menu { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--text); font-size: .84rem; font-weight: 500; }
  .btn-icon-logout { color: var(--text-faint); text-decoration: none; display: flex; align-items: center; }
  .btn-icon-logout:hover { color: var(--danger); }
  .fb-menu-toggle {
    align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius-sm);
    background: none; border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; flex-shrink: 0; margin-right: .3rem;
  }
  .fb-menu-toggle:hover { background: var(--bg); color: var(--text); }

  /* ---- Cuadro de busqueda de empleados (encabezado, solo admin) ---- */
  .fb-search { position: relative; flex-shrink: 0; }
  .fb-search svg { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); color: var(--text-faint); width: 15px; height: 15px; pointer-events: none; }
  .fb-search input { width: 220px; padding: .45rem .8rem .45rem 2rem; border-radius: 999px; font-size: .84rem; background: var(--bg); border: 1px solid var(--border); }
  .fb-search input:focus { width: 260px; }
  .fb-search-resultados {
    display: none; position: absolute; top: calc(100% + 8px); right: 0; width: 320px; max-height: 380px; overflow-y: auto;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 45;
  }
  .fb-search-resultados.activo { display: block; }
  .fb-search-item { display: flex; flex-direction: column; gap: .1rem; padding: .6rem .9rem; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border-soft); }
  .fb-search-item:last-child { border-bottom: none; }
  .fb-search-item:hover { background: var(--bg); }
  .fb-search-item .nombre { font-weight: 600; font-size: .86rem; }
  .fb-search-item .meta { font-size: .74rem; color: var(--text-faint); }
  .fb-search-vacio { padding: .7rem .9rem; font-size: .8rem; color: var(--text-faint); }
  @media (max-width: 860px) { .fb-search input, .fb-search input:focus { width: 130px; } }
  @media (max-width: 640px) { .fb-search { display: none; } }

  /* ---- Layout de 3 columnas: barras pegadas a los bordes reales de la
     pantalla (position:fixed), no centradas en un contenedor con margen ---- */
  .fb-body { max-width: none; margin: 0; padding: 56px 0 0; }
  .fb-left, .fb-right {
    position: fixed; top: 56px; bottom: 0; overflow-y: auto; z-index: 20;
    background: var(--card); transition: transform .28s ease;
  }
  .fb-left { left: 0; width: 260px; border-right: 1px solid var(--border); }
  .fb-right { right: 0; width: 300px; border-left: 1px solid var(--border); display: flex; flex-direction: column; }
  main { padding: 1.75rem 1.5rem 3rem; }
  main.con-izq { margin-left: 260px; }
  main.con-der { margin-right: 300px; }
  .feed-col { max-width: 920px; margin: 0 auto; }

  /* ---- Barra lateral izquierda: modulos de nomina de la empresa (o, sin
     empresa en contexto, el directorio "Mis empresas") -- SIEMPRE visible en
     toda pagina para admin_grupo/admin_udn, nunca desaparece. ---- */
  .fb-left-card { padding: 1rem 0; animation: sidebar-in .3s ease both; }
  .fb-left-back {
    display: flex; align-items: center; gap: .35rem; margin: 0 1.1rem .7rem; padding-bottom: .7rem;
    border-bottom: 1px solid var(--border-soft); text-decoration: none; color: var(--text-muted);
    font-size: .78rem; font-weight: 600; transition: color .15s, transform .15s;
  }
  .fb-left-back:hover { color: var(--teal-600); transform: translateX(-2px); }
  .fb-left-empresa { font-weight: 700; font-size: .88rem; padding: 0 1.1rem .7rem; border-bottom: 1px solid var(--border-soft); margin-bottom: .4rem; }
  .fb-left-empresa .sub { display: block; font-weight: 500; color: var(--text-faint); font-size: .72rem; margin-top: .1rem; }
  .fb-left-link {
    display: flex; align-items: center; gap: .6rem; padding: .5rem 1.1rem; text-decoration: none; color: var(--text-muted);
    font-size: .85rem; font-weight: 500; border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s, transform .15s;
    opacity: 0; animation: link-in .3s ease forwards;
  }
  .fb-left-link:nth-child(1) { animation-delay: .02s; } .fb-left-link:nth-child(2) { animation-delay: .06s; }
  .fb-left-link:nth-child(3) { animation-delay: .1s; } .fb-left-link:nth-child(4) { animation-delay: .14s; }
  .fb-left-link:nth-child(5) { animation-delay: .18s; } .fb-left-link:nth-child(6) { animation-delay: .22s; }
  .fb-left-link:nth-child(7) { animation-delay: .26s; } .fb-left-link:nth-child(8) { animation-delay: .3s; }
  .fb-left-link svg { width: 17px; height: 17px; flex-shrink: 0; transition: transform .15s; }
  .fb-left-link:hover { background: var(--bg); color: var(--text); transform: translateX(3px); }
  .fb-left-link:hover svg { transform: scale(1.08); }
  .fb-left-link.activo { color: var(--teal-600); border-left-color: var(--teal-600); background: var(--teal-100); }
  .fb-left-vacio { padding: .3rem 1.1rem .5rem; font-size: .8rem; color: var(--text-faint); }
  @keyframes sidebar-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes link-in { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: translateX(0); } }

  /* ---- Migas de pan: navegacion "atras" dentro de una empresa ---- */
  .breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; font-size: .82rem; color: var(--text-faint); margin-bottom: 1.1rem; animation: sidebar-in .25s ease both; }
  .breadcrumb a { color: var(--text-muted); text-decoration: none; font-weight: 500; transition: color .15s; }
  .breadcrumb a:hover { color: var(--teal-600); }
  .breadcrumb .actual { color: var(--text); font-weight: 600; }
  .breadcrumb .sep { color: var(--text-faint); }

  /* ---- Sub-nav del portal del empleado (rol=empleado no tiene fb-left) ---- */
  .subnav { display: flex; gap: .4rem; margin-bottom: 1.1rem; flex-wrap: wrap; animation: sidebar-in .25s ease both; }
  .subnav a {
    display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .9rem; border-radius: 999px;
    text-decoration: none; color: var(--text-muted); font-size: .84rem; font-weight: 500; background: var(--card);
    border: 1px solid var(--border); transition: background .15s, color .15s, border-color .15s;
  }
  .subnav a:hover { background: var(--bg); color: var(--text); }
  .subnav a.activo { color: var(--teal-600); border-color: var(--teal-600); background: var(--teal-100); }

  /* ---- Barra lateral derecha: chat (widget global) -- ocupa TODA la
     columna (altura completa fija), la lista de contactos es lo que
     estira/crece y el titulo/footer quedan fijos arriba y abajo. ---- */
  .fb-right-card { display: flex; flex-direction: column; height: 100%; }
  .fb-right-lista { flex: 1; overflow-y: auto; }
  .fb-right-titulo { font-weight: 700; font-size: .84rem; padding: .85rem 1.1rem .6rem; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
  .fb-right-titulo a { font-size: .74rem; font-weight: 500; color: var(--text-muted); text-decoration: none; }
  .fb-right-solicitud { display: flex; align-items: center; gap: .55rem; padding: .5rem 1.1rem; }
  .fb-right-solicitud .nombre { flex: 1; font-size: .82rem; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .fb-right-solicitud form { display: inline; }
  .fb-right-solicitud button { padding: .25rem .5rem; font-size: .72rem; }
  .fb-right-contacto {
    display: flex; align-items: center; gap: .6rem; padding: .5rem 1.1rem; text-decoration: none; color: var(--text);
    font-size: .84rem; font-weight: 500; position: relative;
  }
  .fb-right-contacto:hover { background: var(--bg); }
  .fb-right-contacto span.nombre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .fb-right-badge { background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; border-radius: 999px; min-width: 17px; height: 17px; display: flex; align-items: center; justify-content: center; padding: 0 .3rem; }
  .fb-right-badge[hidden] { display: none; }
  .fb-right-vacio { display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: 1.1rem 1.1rem 1.3rem; text-align: center; }
  .fb-right-vacio svg { color: var(--border); }
  .fb-right-vacio span { font-size: .78rem; color: var(--text-faint); line-height: 1.4; }
  .fb-right-verchat { display: block; text-align: center; padding: .7rem; font-size: .8rem; font-weight: 600; color: var(--teal-600); text-decoration: none; border-top: 1px solid var(--border-soft); flex-shrink: 0; }

  /* ---- Pagina /chat ---- */
  .chat-layout { display: flex; gap: 1.1rem; align-items: flex-start; }
  .chat-lista { width: 260px; flex-shrink: 0; max-height: 70vh; overflow-y: auto; }
  .chat-lista-seccion { padding: .7rem 0; border-bottom: 1px solid var(--border-soft); }
  .chat-lista-seccion:last-child { border-bottom: none; }
  .chat-lista-titulo { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 600; padding: 0 1.1rem .4rem; }
  .chat-solicitud, .chat-directorio-fila { display: flex; align-items: center; gap: .55rem; padding: .4rem 1.1rem; }
  .chat-solicitud-nombre { flex: 1; font-size: .84rem; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-solicitud-acciones { display: flex; gap: .3rem; }
  .chat-contacto { display: flex; align-items: center; gap: .6rem; padding: .5rem 1.1rem; text-decoration: none; color: var(--text); font-size: .86rem; font-weight: 500; }
  .chat-contacto:hover { background: var(--bg); }
  .chat-contacto.activo { background: var(--teal-100); }
  .chat-contacto span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-contacto span.chat-badge { flex: none; }
  .chat-badge[hidden] { display: none; }
  .chat-directorio-fila .btn { white-space: nowrap; }
  .chat-badge { background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; border-radius: 999px; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; padding: 0 .3rem; }
  .chat-conversacion { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 70vh; }
  .chat-conv-header { display: flex; align-items: center; gap: .7rem; padding-bottom: .8rem; border-bottom: 1px solid var(--border-soft); margin-bottom: .8rem; }
  .chat-conv-mensajes { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; padding: .3rem .2rem; }
  .chat-burbuja { align-self: flex-start; background: var(--bg); border-radius: 14px; padding: .5rem .85rem; max-width: 70%; }
  .chat-burbuja p { margin: 0; font-size: .87rem; }
  .chat-burbuja p:empty { display: none; }
  .chat-adjunto-img { display: block; max-width: 220px; max-height: 220px; border-radius: 8px; margin-bottom: .3rem; cursor: zoom-in; }
  /* Mientras llega la foto: un recuadro del tamano aproximado (sin saltos). */
  .chat-adjunto-img.cargando { width: 180px; height: 140px; background: rgba(15,23,42,.08); }
  .chat-adjunto-vencido { font-size: .82rem; color: var(--text-faint); font-style: italic; margin-bottom: .2rem; }
  .chat-adjunto-archivo { display: flex; align-items: center; gap: .3rem; font-size: .82rem; color: var(--teal-600); text-decoration: none; margin-bottom: .2rem; }
  .chat-adjunto-archivo:hover { text-decoration: underline; }
  .chat-burbuja .chat-hora { display: block; font-size: .68rem; color: var(--text-faint); margin-top: .15rem; }
  .chat-burbuja.mio { align-self: flex-end; background: var(--teal-100); }
  /* Mensaje de solo 1-3 emojis: grandes y animados, sin globo (estilo Skype). */
  .chat-burbuja.chat-burbuja-emoji { background: none; padding: .1rem .2rem; }
  .chat-burbuja.chat-burbuja-emoji .chat-hora { text-align: right; }
  .chat-emoji-grande { display: flex; gap: .15rem; align-items: center; }
  .chat-emoji-g {
    display: inline-flex; align-items: center; justify-content: center; width: 4.4rem; height: 4.4rem;
    font-size: 3.3rem; line-height: 1; animation: emoji-entra .45s cubic-bezier(.34,1.56,.64,1) both;
  }
  .chat-emoji-grande.uno .chat-emoji-g { width: 5.6rem; height: 5.6rem; font-size: 4.3rem; }
  .chat-emoji-g svg { width: 100% !important; height: 100% !important; }
  /* Sin animacion publicada: el emoji normal con un rebote suave. */
  .chat-emoji-g.estatico { animation: emoji-entra .45s cubic-bezier(.34,1.56,.64,1) both, emoji-rebote 2.4s ease-in-out .5s infinite; }
  @keyframes emoji-entra { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes emoji-rebote { 0%, 60%, 100% { transform: none; } 20% { transform: translateY(-14%) rotate(-6deg); } 40% { transform: translateY(0) rotate(5deg); } }
  @media (prefers-reduced-motion: reduce) { .chat-emoji-g, .chat-emoji-g.estatico { animation: none; } }
  .chat-escribiendo { align-self: flex-start; display: flex; gap: .2rem; padding: .5rem .85rem; }
  .chat-escribiendo span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); animation: chat-punto 1.2s infinite ease-in-out; }
  .chat-escribiendo span:nth-child(2) { animation-delay: .2s; }
  .chat-escribiendo span:nth-child(3) { animation-delay: .4s; }
  @keyframes chat-punto { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
  .chat-conv-form { display: flex; gap: .6rem; margin-top: .9rem; padding-top: .8rem; border-top: 1px solid var(--border-soft); }
  .chat-conv-form input { flex: 1; border-radius: 999px; }

  @media (max-width: 1300px) { .fb-right { display: none; } main.con-der { margin-right: 0; } }
  @media (max-width: 760px) { .chat-layout { flex-direction: column; } .chat-lista { width: 100%; max-height: none; } .chat-conversacion { height: 60vh; } }

  /* ---- Ventanas de chat ancladas abajo a la derecha, estilo Facebook --
     varias al mismo tiempo, apiladas en fila, cada una independiente
     (pedido explicito de Carlos: "debemos soportar mucho flujo"). ---- */
  .fb-chat-docked { position: fixed; bottom: 0; right: 16px; display: flex; flex-direction: row-reverse; align-items: flex-end; gap: 10px; z-index: 70; }
  .fb-chat-ventana { width: 340px; height: 440px; background: var(--card); border: 1px solid var(--border); border-bottom: none; border-radius: 10px 10px 0 0; box-shadow: 0 -4px 20px -6px rgba(16,24,53,.25); display: flex; flex-direction: column; overflow: hidden; transition: height .15s ease; }
  .fb-chat-ventana.minimizada { height: auto; }
  .fb-chat-ventana-header { display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; background: var(--teal-600); color: #fff; cursor: pointer; flex-shrink: 0; }
  .fb-chat-ventana-header .post-avatar { width: 24px; height: 24px; font-size: .68rem; background: rgba(255,255,255,.25); color: #fff; }
  .fb-chat-ventana-header .nombre { flex: 1; font-size: .83rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .fb-chat-ventana-header button { background: none; border: none; color: #fff; opacity: .85; cursor: pointer; font-size: .95rem; padding: .1rem .3rem; line-height: 1; }
  .fb-chat-ventana-header button:hover { opacity: 1; }
  .fb-chat-ventana-mensajes { flex: 1; overflow-y: auto; padding: .6rem; display: flex; flex-direction: column; gap: .4rem; }
  .fb-chat-ventana.minimizada .fb-chat-ventana-mensajes, .fb-chat-ventana.minimizada .fb-chat-ventana-form { display: none; }
  .fb-chat-ventana-form { display: flex; gap: .4rem; padding: .5rem; border-top: 1px solid var(--border-soft); flex-shrink: 0; align-items: center; }
  .fb-chat-ventana-form input[type=text] { flex: 1; border-radius: 999px; font-size: .82rem; padding: .4rem .7rem; }
  .fb-chat-ventana-adjuntar { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; padding: .2rem .3rem; flex-shrink: 0; }
  .fb-chat-ventana-adjuntar:hover { color: var(--teal-600); }

  /* ---- Emojis y reenviar -- compartido entre las ventanitas y /chat ---- */
  .chat-emoji-popup { position: absolute; bottom: calc(100% + 6px); left: 0; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); z-index: 80; width: 340px; max-width: 90vw; overflow: hidden; }
  .chat-emoji-tabs { display: flex; border-bottom: 1px solid var(--border-soft); background: var(--bg); }
  .chat-emoji-tabs button { flex: 1; background: none; border: none; border-bottom: 2px solid transparent; font-size: 1.05rem; padding: .4rem 0 .3rem; cursor: pointer; filter: grayscale(.6); }
  .chat-emoji-tabs button.activo { border-bottom-color: var(--teal-600); filter: none; background: var(--card); }
  .chat-emoji-titulo { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); padding: .45rem .6rem .1rem; }
  .chat-emoji-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .15rem; padding: .2rem .45rem .5rem; height: 250px; overflow-y: auto; align-content: start; }
  .chat-emoji-grid button { background: none; border: none; font-size: 1.7rem; cursor: pointer; border-radius: 8px; padding: .15rem 0; line-height: 1.25; transition: transform .12s ease, background .12s; }
  .chat-emoji-grid button:hover { background: var(--bg); transform: scale(1.25); }
  .chat-emoji-vacio { grid-column: 1 / -1; font-size: .78rem; color: var(--text-faint); padding: .6rem .2rem; }
  .chat-burbuja { position: relative; }
  /* Responder / reenviar / eliminar: aparecen al pasar el mouse (o al tocar
     la burbuja en celular, clase .tocada) del lado donde hay espacio. */
  .chat-acciones { position: absolute; top: 50%; transform: translateY(-50%); left: calc(100% + 4px); display: flex; gap: 1px;
    opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 2; }
  .chat-burbuja.mio .chat-acciones { left: auto; right: calc(100% + 4px); flex-direction: row-reverse; }
  .chat-burbuja:hover .chat-acciones, .chat-burbuja.tocada .chat-acciones { opacity: 1; pointer-events: auto; }
  .chat-acciones button { cursor: pointer; background: none; border: none; font-size: .82rem; color: var(--text-faint); padding: .15rem .3rem; border-radius: 6px; line-height: 1.2; }
  .chat-acciones button:hover { color: var(--teal-600); background: var(--bg); }
  .chat-acciones .chat-eliminar-btn:hover { color: var(--danger, #dc2626); }
  .chat-acciones .chat-reenviar-popup { top: calc(100% + 2px); right: 0; }
  /* Cita (respuesta estilo WhatsApp): dentro de la burbuja y en la barra
     "Respondiendo a..." arriba de la caja de texto. */
  .chat-cita { display: flex; flex-direction: column; gap: .05rem; border-left: 3px solid #7c3aed; background: rgba(15,23,42,.055);
    border-radius: 7px; padding: .3rem .55rem; margin-bottom: .3rem; cursor: pointer; min-width: 0; }
  .chat-cita.mio { border-left-color: var(--teal-600); }
  .chat-cita b { font-size: .74rem; font-weight: 600; color: #7c3aed; }
  .chat-cita.mio b { color: var(--teal-600); }
  .chat-cita span { font-size: .78rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: pre-wrap; word-break: break-word; }
  .chat-burbuja-emoji .chat-cita { margin-bottom: .1rem; }
  .chat-respondiendo { display: flex; align-items: center; gap: .5rem; padding: .45rem .5rem .1rem; flex-shrink: 0; }
  .chat-respondiendo[hidden] { display: none; }
  .chat-respondiendo .chat-cita { flex: 1; margin: 0; cursor: default; background: var(--bg); }
  .chat-respondiendo-x { background: none; border: none; color: var(--text-faint); font-size: 1rem; cursor: pointer; padding: .2rem .4rem; }
  .chat-respondiendo-x:hover { color: var(--text); }
  .chat-burbuja.resaltada { animation: chat-resaltar 1.4s ease; }
  @keyframes chat-resaltar { 0%, 40% { box-shadow: 0 0 0 4px rgba(124,58,237,.35); } 100% { box-shadow: 0 0 0 0 rgba(124,58,237,0); } }
  /* Indicador al deslizar para responder (celular). */
  .chat-burbuja::before { content: '↩'; position: absolute; left: -2rem; top: 50%; transform: translateY(-50%) scale(.6); opacity: 0;
    width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--bg); color: var(--text-muted); display: flex; align-items: center; justify-content: center; font-size: .85rem; transition: opacity .12s, transform .12s; }
  .chat-burbuja.deslizando::before { opacity: 1; transform: translateY(-50%) scale(1); }
  .chat-reenviado-label { font-size: .68rem; color: var(--text-faint); font-style: italic; margin-bottom: .15rem; display: flex; align-items: center; gap: .2rem; }
  .chat-reenviar-popup { position: absolute; top: 100%; background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); z-index: 80; min-width: 140px; max-height: 180px; overflow-y: auto; }
  .chat-reenviar-popup button { display: block; width: 100%; text-align: left; background: none; border: none; padding: .4rem .7rem; font-size: .78rem; cursor: pointer; }
  .chat-reenviar-popup button:hover { background: var(--bg); }
  .chat-reenviar-popup .vacio { padding: .5rem .7rem; font-size: .76rem; color: var(--text-faint); }
  @media (max-width: 760px) { .fb-chat-docked { display: none; } }

  /* ---- Barra izquierda en pantallas chicas: en vez de desaparecer, se
     convierte en cajon deslizable (nunca se pierde el acceso a los modulos,
     solo cambia la forma en que se llega a ellos segun el tamano de pantalla) ---- */
  .fb-menu-toggle { display: none; }
  @media (max-width: 1050px) {
    .fb-menu-toggle { display: inline-flex; }
    main.con-izq { margin-left: 0; }
    .fb-left {
      top: 0; width: 82vw; max-width: 300px; height: 100vh;
      z-index: 60; transform: translateX(-100%); padding: 1rem;
    }
    .fb-left.abierto { transform: translateX(0); box-shadow: 12px 0 32px rgba(10,14,26,.25); }
    .fb-left .fb-left-card { margin-top: .5rem; }
  }

  /* ---- Tema del portal (app/temas.py, editable en /apariencia) ----
     Disenos de Carlos: la ilustracion del mes rodea el muro; el menu, la
     barra superior y el chat se quedan BLANCOS. Los temas de color (EXPEDIG,
     claro, mis colores) pintan manchas de color en su lugar. */
  body { background: var(--t-base, var(--bg)); }
  .fondo-tema { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
  .fondo-tema.fondo-con-imagen { top: 56px; left: 260px; right: 300px; bottom: 0;
    /* 100% 100%: la ilustracion COMPLETA siempre a la vista (papel picado
       arriba, calaveras/adornos abajo) a cualquier zoom o tamano de pantalla */
    background-size: 100% 100%; background-repeat: no-repeat; background-color: var(--t-base); }
  /* Que el fondo acompane sin deslumbrar (pedido de Carlos): un poco menos
     de saturacion y contraste, y algo mas oscuro en los temas oscuros; las
     tarjetas llevan mas sombra para despegarse del fondo. */
  .fondo-tema.fondo-con-imagen { filter: saturate(.72) contrast(.9); }
  body.fondo-oscuro .fondo-tema.fondo-con-imagen { filter: saturate(.72) contrast(.9) brightness(.82); }
  body.con-panel main :is(.card, .post-card, .stat-tile, .quick-card, .mural-vacio) { box-shadow: 0 8px 28px -6px rgba(0,0,0,.28); }
  @media (max-width: 1300px) { .fondo-tema.fondo-con-imagen { right: 0; } }
  @media (max-width: 1050px) { .fondo-tema.fondo-con-imagen { left: 0; } }
  .fondo-brillo { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; }
  .fondo-brillo-1 { width: 46vw; height: 46vw; left: 10vw; top: -12vw; background: var(--t-g1); }
  .fondo-brillo-2 { width: 40vw; height: 40vw; right: 8vw; top: 22vh; background: var(--t-g2); }
  .fondo-brillo-3 { width: 50vw; height: 42vw; left: 30vw; bottom: -18vw; background: var(--t-g3); }
  .fb-topbar-espacio { flex: 1; }
  /* Barra superior y laterales con un tinte LEVE del tema (profesional) */
  .fb-topbar { background: var(--t-barra, var(--card)); border-bottom-color: rgba(15,23,42,.08); }
  .fb-left, .fb-right { background: var(--t-lateral, var(--card)); border-color: rgba(15,23,42,.08); }
  .fb-left-link:hover, .fb-right-contacto:hover { background: rgba(15,23,42,.06) !important; }
  .fb-left-link.activo, .fb-menu-principal .fb-left-link.activo { background: rgba(15,23,42,.09) !important; }
  .fb-menu-principal, .fb-left-empresa, .fb-right-verchat { border-color: rgba(15,23,42,.1) !important; }
  /* Todo fondo oscuro o ilustrado (predeterminado o "Mis colores"): el
     contenido va sobre un PANEL CLARO ancho, pegado a la barra superior, y el
     fondo queda alrededor como marco. Asi el texto siempre es oscuro sobre
     claro y se lee igual con cualquier color (pedido de Carlos). */
  body.con-panel main { padding: .9rem clamp(1rem, 6vw, 120px) 2rem; }
  @media (max-width: 1050px) { body.con-panel main { padding: .9rem 1rem 2rem; } }
  body.con-panel .main-panel { background: rgba(255,255,255,.93); border-radius: 18px; padding: 1.6rem 1.8rem;
    box-shadow: 0 12px 40px -10px rgba(0,0,0,.35); backdrop-filter: blur(8px); min-height: calc(100vh - 56px - 2.9rem); }
  @media (max-width: 860px) { body.con-panel .main-panel { padding: 1rem; border-radius: 12px; } }

  /* ---- Menu principal en la barra lateral (antes iconos en la barra de arriba) ---- */
  .fb-menu-principal { padding: .8rem .6rem .7rem; border-bottom: 1px solid var(--border); }
  .fb-menu-principal .fb-left-link { border-radius: 10px; border-left: none; margin-bottom: .15rem; }
  .fb-menu-principal .fb-left-link.activo { background: #e8ebf1; color: #0b1220; font-weight: 500; }
  .fb-menu-principal .fb-left-link svg { width: 21px; height: 21px; }

  /* Barras laterales mas marcadas, como en los disenos de Carlos: letra mas
     grande y negra, iconos con trazo firme, activo resaltado en gris. */
  .fb-left, .fb-right { box-shadow: 0 0 18px rgba(16,24,53,.06); }
  .fb-left-link { color: #111827; font-size: .95rem; font-weight: 400; padding: .55rem 1.1rem; }
  .fb-left-link svg { width: 19px; height: 19px; stroke-width: 2.1; }
  .fb-left-link:hover { background: #f1f3f7; color: #0b1220; }
  .fb-left-link.activo { color: #0b1220; font-weight: 500; background: #e8ebf1; border-left-color: #0b1220; }
  .fb-left-empresa { font-size: 1.02rem; color: #0b1220; border-bottom-color: var(--border); padding-top: .2rem; }
  .fb-left-empresa .sub { font-size: .76rem; color: #6b7280; }
  .fb-left-back { color: #374151; font-weight: 500; }
  .fb-right-titulo { font-size: 1.02rem; color: #0b1220; border-bottom: 2px solid var(--teal-600); margin: 0 1.1rem .4rem; padding-left: 0; padding-right: 0; }
  .fb-right-titulo a { color: #374151; }
  .fb-right-contacto { color: #111827; font-size: .93rem; font-weight: 500; padding: .6rem 1.1rem; }
  .fb-right-contacto:hover { background: #f1f3f7; }
  .fb-right-verchat { font-size: .88rem; }

  /* Iconos de color: cada seccion/modulo con el suyo, en el menu y en las
     tarjetas de modulos */
  .fb-left-link svg { color: var(--ic, currentColor); }
  a.quick-card .icon { color: var(--ic, var(--indigo-600)); background: color-mix(in srgb, var(--ic, #4f46e5) 13%, white); }
  :is(.fb-left-link, .quick-card)[href^="/empresas/"] { --ic: #4f46e5; }
  :is(.fb-left-link, .quick-card):is([href="/comunicados"], [href="/mi-portal"]) { --ic: #2563eb; }
  :is(.fb-left-link, .quick-card)[href^="/chat"] { --ic: #0d9488; }
  :is(.fb-left-link, .quick-card)[href="/panel-grupo"] { --ic: #7c3aed; }
  :is(.fb-left-link, .quick-card)[href="/grupos"] { --ic: #9333ea; }
  :is(.fb-left-link, .quick-card)[href="/prospectos"] { --ic: #0d9488; }
  :is(.fb-left-link, .quick-card)[href="/empresas"] { --ic: #ea580c; }
  :is(.fb-left-link, .quick-card)[href="/usuarios"] { --ic: #db2777; }
  :is(.fb-left-link, .quick-card)[href^="/configuracion/tablas"] { --ic: #0891b2; }
  :is(.fb-left-link, .quick-card)[href="/apariencia"] { --ic: #e11d48; }
  :is(.fb-left-link, .quick-card)[href$="/empleados"] { --ic: #2563eb; }
  :is(.fb-left-link, .quick-card)[href$="/vacaciones"] { --ic: #16a34a; }
  :is(.fb-left-link, .quick-card)[href$="/nomina"] { --ic: #0d9488; }
  :is(.fb-left-link, .quick-card)[href$="/finiquitos"] { --ic: #dc2626; }
  :is(.fb-left-link, .quick-card)[href$="/timbrado"] { --ic: #7c3aed; }
  :is(.fb-left-link, .quick-card)[href$="/analisis-nomina"] { --ic: #ca8a04; }
  :is(.fb-left-link, .quick-card)[href$="/isn"] { --ic: #0891b2; }
  :is(.fb-left-link, .quick-card)[href$="/imss"] { --ic: #059669; }
  :is(.fb-left-link, .quick-card)[href$="/poliza"] { --ic: #b45309; }
  :is(.fb-left-link, .quick-card)[href$="/gafetes"] { --ic: #db2777; }
  :is(.fb-left-link, .quick-card)[href$="/psicometrico"] { --ic: #9333ea; }
  :is(.fb-left-link, .quick-card)[href$="/configuracion"] { --ic: #0f766e; }
  :is(.fb-left-link, .quick-card)[href$="/modulos"] { --ic: #4f46e5; }
  :is(.fb-left-link, .quick-card)[href$="/editar"] { --ic: #ea580c; }
  /* ---- Vista previa de PDF en ventana flotante ---- */
  .pdf-visor { position: fixed; inset: 0; z-index: 200; background: rgba(10,14,26,.6); display: flex; align-items: center; justify-content: center; padding: 2vh 2vw; }
  .pdf-visor-caja { background: var(--card); border-radius: 14px; width: min(1000px, 96vw); height: 94vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
  .pdf-visor-barra { display: flex; align-items: center; gap: .6rem; padding: .6rem .9rem; border-bottom: 1px solid var(--border); }
  .pdf-visor-barra strong { flex: 1; font-size: .92rem; }
  .pdf-visor-cerrar { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
  .pdf-visor iframe { flex: 1; width: 100%; border: 0; background: #525659; }
  .pdf-visor-cargando { position: absolute; color: #fff; font-size: .9rem; }
  .drawer-overlay {
    display: none; position: fixed; inset: 0; background: rgba(10,14,26,.45); z-index: 55;
    opacity: 0; transition: opacity .25s ease;
  }
  .drawer-overlay.activo { display: block; opacity: 1; }

  h1 { font-size: 1.45rem; font-weight: 600; margin: 0 0 .3rem; letter-spacing: -.01em; }
  h2 { font-size: 1.1rem; font-weight: 600; }
  h3 { font-size: .98rem; font-weight: 600; }

  /* ---- Cards ---- */
  .card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.35rem 1.5rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); overflow-x: auto; }
  .card-flat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.35rem 1.5rem; margin-bottom: 1.25rem; overflow-x: auto; }

  /* ---- Stat tiles (KPIs) ---- */
  .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
  .stat-tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
  .stat-tile .stat-label { font-size: .76rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .4rem; }
  .stat-tile .stat-value { font-size: 1.55rem; font-weight: 700; letter-spacing: -.01em; }
  .stat-tile .stat-sub { font-size: .78rem; color: var(--text-faint); margin-top: .2rem; }
  .stat-tile.accent-teal .stat-value { color: var(--teal-600); }
  .stat-tile.accent-indigo .stat-value { color: var(--indigo-600); }
  .stat-tile.accent-warning .stat-value { color: var(--warning); }

  /* ---- Tables ---- */
  /* min-width en vez de solo width: si el contenido no cabe en pantallas
     angostas, la tabla se ensancha y .card (overflow-x:auto) la hace
     scrollable -- sin esto, el layout automático de <table> comprime la
     ultima columna letra por letra en vez de dejarla legible. */
  table { width: 100%; min-width: max-content; border-collapse: collapse; }
  th, td { text-align: left; padding: .68rem .7rem; font-size: .87rem; white-space: nowrap; }
  th:first-child, td:first-child { white-space: normal; }
  thead th { color: var(--text-muted); font-weight: 500; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); padding-bottom: .6rem; }
  tbody tr { border-bottom: 1px solid var(--border-soft); }
  tbody tr:last-child { border-bottom: none; }
  tbody tr:hover { background: #fafbfe; }
  tbody tr.fila-clicable { cursor: pointer; }

  /* ---- Buttons ---- */
  .btn {
    display: inline-flex; align-items: center; gap: .4rem; background: var(--navy-900); color: #fff; border: none;
    padding: .55rem 1.05rem; border-radius: var(--radius-sm); text-decoration: none; font-size: .87rem; font-weight: 500;
    cursor: pointer; transition: transform .05s, opacity .12s; box-shadow: 0 1px 1px rgba(16,24,53,.05);
  }
  .btn:hover { opacity: .9; }
  .btn:active { transform: translateY(1px); }
  .btn-secundario { background: var(--card); color: var(--text); border: 1px solid var(--border); }
  .btn-secundario:hover { background: #f8f9fc; opacity: 1; }
  .btn-teal { background: var(--teal-600); }
  .btn[disabled] { opacity: .5; cursor: not-allowed; }

  /* ---- Forms ---- */
  label { display: block; font-size: .82rem; font-weight: 500; margin: .8rem 0 .3rem; color: var(--text); }
  input, select, textarea {
    width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: .89rem; font-family: inherit; background: #fff; color: var(--text);
  }
  input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(20,184,166,.15); }

  /* ---- Icono de ayuda "?" junto a un label -- para campos de configuracion
     que no son obvios para alguien sin conocimiento tecnico/fiscal (claves
     SAT, tablas de ley, rutas, etc.). Sin JS: :hover para mouse, :focus para
     tap/teclado (tabindex=0 lo vuelve enfocable). El texto vive en
     data-tip="..." de cada <span class="ayuda">, no hace falta tocar este
     bloque para agregar ayuda nueva en otra pantalla. ---- */
  .ayuda {
    display: inline-flex; align-items: center; justify-content: center; width: 1.05rem; height: 1.05rem;
    border-radius: 50%; background: var(--border-soft); color: var(--text-muted); font-size: .68rem; font-weight: 600;
    cursor: help; margin-left: .35rem; position: relative; vertical-align: middle; user-select: none;
  }
  .ayuda:hover, .ayuda:focus { background: var(--teal-500); color: #fff; outline: none; }
  .ayuda::after {
    content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) translateY(4px);
    width: max-content; max-width: 260px; background: var(--navy-900); color: #fff; font-size: .76rem; font-weight: 400;
    line-height: 1.35; padding: .55rem .7rem; border-radius: var(--radius-sm); box-shadow: 0 6px 18px rgba(16,24,53,.25);
    opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s; z-index: 40; text-align: left;
  }
  .ayuda:hover::after, .ayuda:focus::after { opacity: 1; transform: translateX(-50%) translateY(0); }
  @media (max-width: 480px) { .ayuda::after { max-width: 68vw; } }

  /* ---- Buscador para <select> largos (ver activarBuscadoresSelect en el
     script de abajo) -- filtra las <option> por texto sin reemplazar el
     select nativo, funciona igual en selects simples y multiple. ---- */
  .select-buscador { margin-bottom: .4rem; background: #fff; }
  .select-buscador::placeholder { color: var(--text-faint); }

  /* ---- Alerts / badges ---- */
  .error { background: var(--danger-bg); color: #a12b2b; padding: .7rem 1rem; border-radius: var(--radius-sm); font-size: .87rem; margin-bottom: 1rem; }
  .ok { background: var(--success-bg); color: #1d6b3f; padding: .7rem 1rem; border-radius: var(--radius-sm); font-size: .87rem; margin-bottom: 1rem; }
  .badge { display: inline-block; background: var(--border-soft); border-radius: 999px; padding: .18rem .62rem; font-size: .72rem; font-weight: 500; color: var(--text-muted); }
  .badge[hidden] { display: none; }
  .badge-success { background: var(--success-bg); color: var(--success); }
  .badge-warning { background: var(--warning-bg); color: var(--warning); }
  .badge-info { background: var(--info-bg); color: var(--info); }
  .credenciales { background: var(--warning-bg); border: 1px solid #f0d98c; border-radius: var(--radius-sm); padding: 1rem; font-family: 'SFMono-Regular', Consolas, monospace; font-size: .85rem; }

  /* ---- Barra de progreso de timbrado en lote (ver timbrarPeriodoConProgreso
     en el script de abajo) -- usada en timbrado.html y nomina_periodo.html. ---- */
  .progreso-timbrado { margin-top: .6rem; min-width: 220px; }
  .progreso-barra { height: 10px; border-radius: 999px; background: var(--border-soft); overflow: hidden; }
  .progreso-barra-fill { height: 100%; width: 0%; background: var(--teal-500); transition: width .15s ease; }
  .progreso-barra-fill.con-errores { background: var(--warning); }
  .progreso-texto { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }
  .progreso-texto strong { color: var(--text); }

  /* ---- Muro / feed ---- */
  .muro-post { border-bottom: 1px solid var(--border-soft); padding: 1.1rem 0; }
  .muro-post:last-child { border-bottom: none; }
  .muro-post h3 { margin: 0 0 .3rem; }
  .muro-post .meta { font-size: .78rem; color: var(--text-faint); margin-bottom: .5rem; }

  /* ---- Quick links grid (dashboard cards) ---- */
  .quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }
  .quick-card { display: flex; flex-direction: column; gap: .5rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .1s, border-color .1s; }
  .quick-card:hover { transform: translateY(-2px); border-color: var(--teal-500); box-shadow: 0 8px 20px -8px rgba(16,24,53,.22); }
  .quick-card .icon { width: 34px; height: 34px; border-radius: 9px; background: var(--indigo-50); color: var(--indigo-600); display: flex; align-items: center; justify-content: center; }
  .quick-card .icon svg { width: 18px; height: 18px; }
  .quick-card .titulo { font-weight: 600; font-size: .93rem; }
  .quick-card .desc { font-size: .78rem; color: var(--text-muted); }

  .chart-box { position: relative; height: 260px; }
  .chart-box-sm { position: relative; height: 190px; }

  /* ---- Muro social (estilo Facebook) ---- */
  @keyframes post-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes like-pop { 0% { transform: scale(1); } 40% { transform: scale(1.28); } 100% { transform: scale(1); } }
  .post-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.35rem;
    margin-bottom: 1.1rem; box-shadow: var(--shadow); animation: post-in .35s ease both;
  }
  .post-card.post-reconocimiento { border-left: 4px solid #f59e0b; background: linear-gradient(180deg, #fffaf0, var(--card) 40%); }
  .post-header { display: flex; align-items: flex-start; gap: .7rem; margin-bottom: .6rem; }
  .post-avatar {
    width: 40px; height: 40px; border-radius: 50%; background: var(--indigo-50); color: var(--indigo-600);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; flex-shrink: 0;
  }
  .post-autor { font-weight: 600; font-size: .93rem; }
  .post-reconoce { font-weight: 500; color: var(--text-muted); }
  .post-meta { font-size: .76rem; color: var(--text-faint); margin-top: .1rem; }
  .post-badge-reconocimiento { margin-left: auto; background: #fef3c7; color: #92400e; font-size: .72rem; font-weight: 600; padding: .25rem .6rem; border-radius: 999px; white-space: nowrap; }
  .post-titulo { margin: 0 0 .3rem; font-size: 1rem; }
  .post-contenido { margin: 0 0 .8rem; font-size: .89rem; line-height: 1.5; white-space: pre-wrap; }
  .post-imagen { margin: 0 0 .9rem; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-soft); }
  .post-imagen img { display: block; width: 100%; max-height: 420px; object-fit: cover; cursor: zoom-in; }
  /* Visor: clic en la foto de una publicacion la abre completa ahi mismo. */
  .visor-foto {
    position: fixed; inset: 0; z-index: 100; background: rgba(6,10,24,.92); display: flex; align-items: center; justify-content: center;
    padding: 3.5rem 1.5rem 1.5rem; cursor: zoom-out; animation: visor-in .18s ease both;
  }
  .visor-foto[hidden] { display: none; }
  .visor-foto img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.5); animation: visor-zoom .22s ease both; }
  .visor-foto { padding-top: max(3.5rem, calc(env(safe-area-inset-top) + 3.5rem)); padding-bottom: max(1.5rem, env(safe-area-inset-bottom)); }
  .visor-foto img.mejorando { filter: blur(.4px); }
  .visor-cerrar {
    position: absolute; top: max(.8rem, calc(env(safe-area-inset-top) + .5rem)); right: .8rem; width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255,255,255,.18); color: #fff; font-size: 1.7rem; line-height: 1; display: flex; align-items: center; justify-content: center;
  }
  .visor-cerrar:hover { background: rgba(255,255,255,.28); }
  @keyframes visor-in { from { opacity: 0; } to { opacity: 1; } }
  @keyframes visor-zoom { from { transform: scale(.94); } to { transform: scale(1); } }
  .post-header-der { margin-left: auto; display: flex; align-items: center; gap: .4rem; }
  .post-header-der .post-badge-reconocimiento { margin-left: 0; }
  .post-menu { position: relative; }
  .post-menu-btn { width: 34px; height: 34px; border-radius: 50%; border: none; background: none; color: var(--text-faint); cursor: pointer; display: flex; align-items: center; justify-content: center; }
  .post-menu-btn:hover { background: var(--border-soft); color: var(--text); }
  .post-menu-lista { position: absolute; right: 0; top: calc(100% + 4px); z-index: 25; min-width: 210px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: .3rem; }
  .post-menu-lista button { display: flex; align-items: center; gap: .55rem; width: 100%; background: none; border: none; padding: .55rem .7rem; border-radius: 6px; cursor: pointer; font-size: .84rem; font-weight: 500; color: var(--danger); text-align: left; }
  .post-menu-lista button:hover { background: var(--danger-bg); }
  .post-eliminando { animation: post-out .3s ease forwards; }
  @keyframes post-out { to { opacity: 0; transform: scale(.97); } }

  .post-resumen { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .1rem .1rem .55rem; font-size: .82rem; color: var(--text-muted); }
  .reac-resumen { display: inline-flex; align-items: center; gap: .35rem; cursor: default; }
  .reac-iconos { display: inline-flex; }
  .reac-iconos span { width: 20px; height: 20px; border-radius: 50%; background: var(--card); border: 2px solid var(--card); display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; margin-left: -5px; box-shadow: 0 0 0 1px var(--border-soft); }
  .reac-iconos span:first-child { margin-left: 0; }
  .post-comment-count { font-size: .82rem; color: var(--text-faint); margin-left: auto; }

  .post-acciones { display: flex; align-items: center; gap: .3rem; padding: .3rem 0; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); margin-bottom: .7rem; }
  .post-acciones > .reac-wrap, .post-acciones > .js-ir-comentar { flex: 1; }
  .post-accion {
    width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-weight: 500; font-size: .86rem; padding: .5rem .6rem; border-radius: var(--radius-sm); transition: background .12s, color .12s;
  }
  .post-accion:hover { background: var(--border-soft); }
  .reac-emoji { font-size: 1.1rem; line-height: 1; }
  .reac-btn.activo { color: var(--info); }
  .reac-btn.reac-me_encanta { color: #e11d48; }
  .reac-btn.reac-felicidades, .reac-btn.reac-aplausos { color: #d97706; }
  .reac-btn.pop .reac-emoji, .reac-btn.pop svg { animation: like-pop .35s ease; }

  /* Selector de reacciones: aparece al pasar el cursor (o dejar presionado
     en celular) sobre "Me gusta", como en Facebook. */
  .reac-wrap { position: relative; display: inline-flex; }
  .reac-picker {
    position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 26; display: flex; gap: .15rem; padding: .3rem .4rem;
    background: var(--card); border: 1px solid var(--border); border-radius: 999px; box-shadow: 0 8px 28px -8px rgba(16,24,53,.35);
    opacity: 0; visibility: hidden; transform: translateY(6px) scale(.96); transform-origin: bottom left;
    transition: opacity .15s ease, transform .15s ease, visibility 0s linear .15s;
  }
  .reac-wrap:hover .reac-picker, .reac-wrap.abierto .reac-picker {
    opacity: 1; visibility: visible; transform: none; transition-delay: .35s, .35s, 0s;
  }
  .reac-wrap.abierto .reac-picker { transition-delay: 0s; }
  .reac-picker::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 10px; }
  .reac-picker button { position: relative; background: none; border: none; cursor: pointer; padding: .1rem; border-radius: 50%; transition: transform .14s ease; }
  .reac-picker button span { font-size: 1.65rem; line-height: 1.15; display: block; }
  .reac-picker button:hover { transform: translateY(-5px) scale(1.25); }
  .reac-picker button em {
    position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); white-space: nowrap; pointer-events: none;
    background: rgba(15,23,42,.88); color: #fff; font-style: normal; font-size: .66rem; font-weight: 600; padding: .12rem .45rem; border-radius: 999px; opacity: 0; transition: opacity .1s;
  }
  .reac-picker button:hover em { opacity: 1; }
  .reac-mini .reac-picker button span { font-size: 1.35rem; }

  .post-comentarios { display: flex; flex-direction: column; gap: .6rem; }
  .hilo { display: flex; flex-direction: column; gap: .45rem; }
  .comentario { display: flex; gap: .55rem; align-items: flex-start; }
  .comentario-avatar {
    width: 30px; height: 30px; border-radius: 50%; background: var(--border-soft); color: var(--text-muted);
    display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: .76rem; flex-shrink: 0;
  }
  .comentario-cuerpo { min-width: 0; }
  .comentario-burbuja { position: relative; display: inline-block; max-width: 100%; background: var(--bg); border-radius: 14px; padding: .45rem .8rem; font-size: .85rem; }
  .comentario-burbuja strong { display: block; font-size: .78rem; margin-bottom: .1rem; }
  .comentario-burbuja p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
  .com-reac-badge {
    position: absolute; right: -8px; bottom: -10px; background: var(--card); border-radius: 999px; padding: .05rem .38rem;
    font-size: .72rem; font-weight: 600; color: var(--text-muted); box-shadow: 0 1px 4px rgba(16,24,53,.18); white-space: nowrap;
  }
  .comentario-acciones { display: flex; align-items: center; flex-wrap: wrap; gap: .15rem .8rem; padding: .2rem .6rem 0; font-size: .74rem; color: var(--text-faint); }
  .comentario-acciones button { background: none; border: none; padding: 0; cursor: pointer; font-size: .74rem; font-weight: 600; color: var(--text-muted); }
  .comentario-acciones button:hover { text-decoration: underline; }
  .comentario-acciones .reac-link.activo { color: var(--info); }
  .comentario-acciones .reac-link.reac-me_encanta { color: #e11d48; }
  .comentario-acciones .reac-link.reac-felicidades, .comentario-acciones .reac-link.reac-aplausos { color: #d97706; }
  .comentario-acciones .js-eliminar-com { color: var(--text-faint); font-weight: 500; }
  .comentario-acciones .js-eliminar-com:hover { color: var(--danger); }
  .comentario-respuestas { margin-left: 2.4rem; display: flex; flex-direction: column; gap: .45rem; }
  .comentario-respuestas:empty { display: none; }
  .comentario-respuestas .comentario-avatar { width: 24px; height: 24px; font-size: .66rem; }
  .comentario-nueva { animation: post-in .25s ease both; }
  .form-comentario { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .2rem; }
  .form-comentario[hidden] { display: none; }
  .form-comentario input { flex: 1; min-width: 0; border-radius: 999px; padding: .45rem .9rem; font-size: .83rem; }
  .form-error { flex-basis: 100%; background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; border-radius: var(--radius-sm); padding: .45rem .7rem; font-size: .8rem; }
  .form-error[hidden] { display: none; }

  /* Confirmacion propia (eliminar) -- en vez del confirm() del navegador. */
  .confirmar-fondo { position: fixed; inset: 0; z-index: 110; background: rgba(6,10,24,.5); display: flex; align-items: center; justify-content: center; padding: 1rem; animation: visor-in .15s ease both; }
  .confirmar-caja { background: var(--card); border-radius: var(--radius); box-shadow: 0 24px 60px -12px rgba(0,0,0,.4); padding: 1.3rem 1.4rem 1.1rem; width: 100%; max-width: 400px; animation: visor-zoom .18s ease both; }
  .confirmar-caja h4 { margin: 0 0 .4rem; font-size: 1.02rem; }
  .confirmar-caja p { margin: 0 0 1.1rem; font-size: .86rem; color: var(--text-muted); line-height: 1.45; }
  .confirmar-botones { display: flex; justify-content: flex-end; gap: .5rem; }
  .btn-peligro { background: var(--danger); color: #fff; border-color: var(--danger); }
  .btn-sm { padding: .4rem .8rem; font-size: .8rem; border-radius: 999px; }
  .muro-publicar-tipo { display: flex; gap: .6rem; margin: .3rem 0 .9rem; }
  .muro-publicar-tipo label {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: .4rem; margin: 0; padding: .55rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .83rem; font-weight: 500; cursor: pointer; color: var(--text-muted);
  }
  .muro-publicar-tipo input { display: none; }
  .muro-publicar-tipo input:checked + span { color: var(--indigo-600); }
  .muro-publicar-tipo label:has(input:checked) { border-color: var(--indigo-600); background: var(--indigo-50); color: var(--indigo-600); }

  /* ---- Composer (caja de publicar, estilo Facebook) ---- */
  .fb-composer-top { display: flex; align-items: center; gap: .7rem; margin-bottom: .6rem; }
  .fb-composer-top .post-avatar { flex-shrink: 0; }
  .fb-composer-input {
    flex: 1; background: var(--bg); border: none; border-radius: 999px; padding: .7rem 1rem;
    font-size: .92rem; font-weight: 500;
  }
  .fb-composer-input:focus { box-shadow: 0 0 0 2px var(--teal-500) inset; }
  .fb-composer-actions {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .9rem;
    padding-top: .8rem; border-top: 1px solid var(--border-soft); flex-wrap: wrap;
  }
  .fb-composer-action {
    display: inline-flex; align-items: center; gap: .4rem; color: var(--text-muted); font-size: .83rem; font-weight: 500;
    cursor: pointer; padding: .4rem .7rem; border-radius: var(--radius-sm); border: 1px solid var(--border);
  }
  .fb-composer-action:hover { background: var(--bg); }
  .fb-composer-action svg { width: 17px; height: 17px; }
  .fb-composer-actions select { width: auto; flex: 1; min-width: 160px; }
  .fb-composer-destacar {
    display: inline-flex; align-items: center; gap: .4rem; font-size: .83rem; font-weight: 500; color: #92400e;
    background: #fffbeb; border: 1px solid #fde68a; padding: .4rem .7rem; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
  }
  .fb-composer-destacar input { width: auto; margin: 0; accent-color: #f59e0b; }

  /* ---- Mural: carrusel de fotos destacadas, tipo pantalla gigante ---- */
  .mural { margin-bottom: 1.25rem; }
  .mural-pantalla {
    position: relative; aspect-ratio: 16 / 9; max-width: 100%; border-radius: var(--radius); overflow: hidden;
    background: var(--navy-950); box-shadow: 0 2px 4px rgba(16,24,53,.08), 0 18px 40px -18px rgba(16,24,53,.45); outline: none;
  }
  .mural-pantalla:focus-visible { box-shadow: 0 0 0 3px var(--teal-500); }
  .mural-slide {
    position: absolute; inset: 0; display: block; color: #fff; text-decoration: none;
    opacity: 0; transition: opacity .9s ease; pointer-events: none;
  }
  .mural-slide.activo { opacity: 1; pointer-events: auto; }
  /* La misma foto, desenfocada, rellena los lados: una foto vertical o
     cuadrada se ve completa (sin recortar caras) y la pantalla no queda con
     barras negras. */
  .mural-fondo { position: absolute; inset: -30px; background-size: cover; background-position: center; filter: blur(28px) brightness(.55) saturate(1.2); }
  .mural-slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
  .mural-slide.activo img { animation: mural-zoom 9s ease-out both; }
  .mural-slide video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
  .post-video video { display: block; width: 100%; max-height: 520px; background: #000; }
  @keyframes mural-zoom { from { transform: scale(1); } to { transform: scale(1.045); } }
  .mural-caption {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 3.5rem 1.4rem 1.15rem;
    background: linear-gradient(to top, rgba(8,12,28,.88), rgba(8,12,28,.45) 55%, transparent);
  }
  .mural-caption h3 { margin: .35rem 0 0; font-size: 1.3rem; font-weight: 700; line-height: 1.2; text-shadow: 0 1px 6px rgba(0,0,0,.4); }
  .mural-caption p { margin: .25rem 0 0; font-size: .84rem; opacity: .9; }
  .mural-caption-meta { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; font-size: .74rem; font-weight: 500; opacity: .92; }
  .mural-chip { background: rgba(255,255,255,.18); backdrop-filter: blur(6px); padding: .18rem .6rem; border-radius: 999px; }
  .mural-chip-oro { background: rgba(245,158,11,.9); color: #1f1300; }
  .mural-slide.activo .mural-caption > * { animation: post-in .6s ease both; }
  .mural-slide.activo .mural-caption h3 { animation-delay: .1s; }

  .mural-segmentos { position: absolute; top: .7rem; left: .9rem; right: .9rem; display: flex; gap: 4px; z-index: 3; }
  .mural-seg { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.3); overflow: hidden; }
  .mural-seg-fill { display: block; height: 100%; width: 0; background: #fff; }
  .mural-seg.hecho .mural-seg-fill { width: 100%; }
  .mural-seg.activo .mural-seg-fill { animation: mural-avance var(--mural-intervalo, 7s) linear forwards; }
  .mural.pausado .mural-seg.activo .mural-seg-fill { animation-play-state: paused; }
  /* Segmento de un video: lo llena el JS con el avance real del video. */
  .mural-seg.mural-seg-video.activo .mural-seg-fill { animation: none; transition: width .25s linear; }
  @keyframes mural-avance { from { width: 0; } to { width: 100%; } }

  .mural-top { position: absolute; top: 1.35rem; left: .9rem; right: .9rem; display: flex; align-items: center; gap: .5rem; z-index: 3; color: #fff; }
  .mural-etiqueta { display: inline-flex; align-items: center; gap: .4rem; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: rgba(0,0,0,.35); backdrop-filter: blur(6px); padding: .25rem .65rem; border-radius: 999px; }
  .mural-punto { width: 7px; height: 7px; border-radius: 50%; background: #f43f5e; box-shadow: 0 0 0 0 rgba(244,63,94,.7); animation: mural-latido 1.8s infinite; }
  .mural.pausado .mural-punto { animation: none; background: #cbd5e1; }
  @keyframes mural-latido { 70% { box-shadow: 0 0 0 7px rgba(244,63,94,0); } 100% { box-shadow: 0 0 0 0 rgba(244,63,94,0); } }
  .mural-contador { margin-left: auto; font-size: .76rem; font-weight: 600; background: rgba(0,0,0,.35); backdrop-filter: blur(6px); padding: .25rem .6rem; border-radius: 999px; font-variant-numeric: tabular-nums; }
  .mural-btn {
    width: 32px; height: 32px; border-radius: 50%; border: none; cursor: pointer; color: #fff; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.35); backdrop-filter: blur(6px); transition: background .15s; padding: 0;
  }
  .mural-btn:hover { background: rgba(0,0,0,.6); }
  .mural-btn svg { width: 16px; height: 16px; }
  .mural-pausa .ico-play, .mural.pausado .mural-pausa .ico-pausa { display: none; }
  .mural.pausado .mural-pausa .ico-play { display: block; }
  .mural-flecha {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 42px; height: 42px; border-radius: 50%;
    border: none; cursor: pointer; color: #fff; background: rgba(0,0,0,.3); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s, background .15s; padding: 0;
  }
  .mural-flecha svg { width: 22px; height: 22px; }
  .mural-flecha:hover { background: rgba(0,0,0,.6); }
  .mural-prev { left: .8rem; } .mural-next { right: .8rem; }
  .mural-pantalla:hover .mural-flecha, .mural-pantalla:focus-within .mural-flecha { opacity: 1; }
  @media (hover: none) { .mural-flecha { opacity: .85; } }

  /* Pantalla completa: para dejarlo corriendo en una TV de la agencia. */
  .mural-pantalla:fullscreen { aspect-ratio: auto; width: 100vw; height: 100vh; border-radius: 0; }
  .mural-pantalla:fullscreen .mural-caption { padding: 6rem 3rem 2.5rem; }
  .mural-pantalla:fullscreen .mural-caption h3 { font-size: 2.6rem; }
  .mural-pantalla:fullscreen .mural-caption p, .mural-pantalla:fullscreen .mural-caption-meta { font-size: 1.1rem; }
  .mural-pantalla:fullscreen .mural-slide.activo img { animation: none; }

  @media (max-width: 640px) {
    .mural-pantalla { aspect-ratio: 4 / 3; }
    .mural-caption { padding: 2.5rem 1rem .9rem; }
    .mural-caption h3 { font-size: 1.05rem; }
  }
  @media (prefers-reduced-motion: reduce) {
    .mural-slide { transition: none; }
    .mural-slide.activo img, .mural-slide.activo .mural-caption > * { animation: none; }
  }

  .mural-vacio {
    display: flex; gap: 1rem; align-items: center; margin-bottom: 1.25rem; padding: 1.1rem 1.3rem;
    border: 2px dashed #fcd34d; border-radius: var(--radius); background: #fffdf5; color: var(--text-muted); font-size: .85rem;
  }
  .mural-vacio strong { color: var(--text); font-size: .95rem; }
  .mural-vacio p { margin: .2rem 0 0; line-height: 1.45; }
  .mural-vacio-ico { font-size: 1.8rem; flex-shrink: 0; }
  .mural-aviso { padding: .8rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .87rem; font-weight: 500; }
  .mural-aviso-ok { background: var(--success-bg); color: #166534; border: 1px solid #bbf7d0; }
  .mural-aviso-warn { background: var(--warning-bg); color: #92400e; border: 1px solid #fde68a; }

  .post-destacar {
    margin-left: auto; display: inline-flex; align-items: center; gap: .35rem; background: none; cursor: pointer;
    border: 1px solid var(--border); color: var(--text-muted); font-weight: 500; font-size: .78rem; padding: .3rem .7rem; border-radius: 999px;
    filter: grayscale(1); transition: background .12s, color .12s, filter .12s;
  }
  .post-destacar:hover { background: var(--border-soft); filter: none; }
  .post-destacar.activo { filter: none; background: #fef3c7; border-color: #fcd34d; color: #92400e; }
  .post-destacar:disabled { opacity: .6; cursor: wait; }

  /* ---- Mobile ---- */
  @media (max-width: 860px) {
    .fb-brand-sub { display: none; }
    main { padding: 1.25rem 1rem 2.5rem; }
  }

  /* ==== MODO APP (celular) ====
     html.app-movil lo pone el script del <head>: telefono (cualquier
     navegador movil, vertical u horizontal) o ventana angosta. El portal se
     comporta como app: barra de pestanas abajo, contenido a todo lo ancho y
     el chat a pantalla completa (lista -> conversacion, como WhatsApp). */
  .app-tabbar { display: none; }
  /* Celular: la ventanita es un cuadro flotante encima de cualquier pantalla
     (pedido de Carlos: contestar sin salir de lo que esta viendo); "–" la
     minimiza al circulito (.chat-cabeza). Se ajusta al teclado (--vv-*). */
  html.app-movil .fb-chat-docked { display: block; position: static; }
  html.app-movil .fb-chat-ventana {
    position: fixed; left: 8px; right: 8px; width: auto; z-index: 96;
    top: calc(var(--vv-top, 0px) + max(10px, env(safe-area-inset-top) + 6px));
    height: min(600px, calc(var(--vv-alto, 100dvh) - max(20px, env(safe-area-inset-top) + 16px) - 64px));
    border: none; border-radius: 16px; box-shadow: 0 18px 50px -8px rgba(0,0,0,.45); background: #f0f2f5;
    animation: chat-flotante-in .18s ease both;
  }
  html.app-movil .fb-chat-ventana-header { padding: .65rem .8rem; }
  html.app-movil .fb-chat-ventana-header .nombre { font-size: 1rem; }
  html.app-movil .fb-chat-ventana-header .post-avatar { width: 30px; height: 30px; font-size: .8rem; }
  html.app-movil .fb-chat-ventana-header button { font-size: 1.25rem; padding: .25rem .5rem; }
  html.app-movil .fb-chat-ventana-mensajes { padding: .7rem .75rem; overscroll-behavior: contain; }
  html.app-movil .fb-chat-ventana-form { background: #f0f2f5; border-top: none; }
  html.app-movil .fb-chat-ventana-form input[type=text] { font-size: 16px; padding: .55rem .85rem; } /* <16px: iPhone hace zoom */
  @keyframes chat-flotante-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
  html.app-movil .fb-right { display: none; }
  html.app-movil main.con-der { margin-right: 0; }
  html.app-movil .fb-topbar-inner { height: 52px; padding: 0 .75rem; padding-left: max(.75rem, env(safe-area-inset-left)); padding-right: max(.75rem, env(safe-area-inset-right)); }
  html.app-movil .fb-body { padding-top: 52px; }
  html.app-movil .fb-left { top: 0; }
  html.app-movil .fb-search, html.app-movil .fb-brand-sub { display: none; }
  html.app-movil body.rol-empleado .fb-menu-toggle { display: none; }
  html.app-movil .fondo-tema.fondo-con-imagen { top: 52px; left: 0; right: 0; }
  /* iOS hace zoom al escribir en cajas con letra < 16px (y la pagina queda
     movida/desacomodada): en celular todas las cajas van a 16px. */
  html.app-movil :is(input, select, textarea) { font-size: 16px; }
  html.app-movil main, html.app-movil body.con-panel main { padding: .55rem .5rem calc(76px + env(safe-area-inset-bottom)); }
  html.app-movil .main-panel, html.app-movil body.con-panel .main-panel { padding: 1rem .85rem; border-radius: 14px; min-height: calc(100dvh - 52px - 1.1rem - 64px); }
  html.app-movil h1 { font-size: 1.35rem; }
  /* Sub-menu del portal del empleado: una sola fila deslizable */
  html.app-movil .subnav { flex-wrap: nowrap; overflow-x: auto; margin: 0 -.85rem 1rem; padding: 0 .85rem .2rem; scrollbar-width: none; }
  html.app-movil .subnav::-webkit-scrollbar { display: none; }
  html.app-movil .subnav a { flex-shrink: 0; white-space: nowrap; }
  /* Tablas anchas: se deslizan de lado en vez de romper la pantalla */
  html.app-movil .main-panel table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  html.app-movil .app-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--t-barra, #fff);
    border-top: 1px solid rgba(15,23,42,.1); box-shadow: 0 -4px 18px rgba(16,24,53,.08);
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .app-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; height: 60px;
    text-decoration: none; color: #6b7280; font-size: .68rem; font-weight: 500; background: none; border: none; font-family: inherit; position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .app-tab svg { width: 23px; height: 23px; }
  .app-tab.activo { color: #0b1220; font-weight: 600; }
  .app-tab.activo svg { color: var(--ic, var(--teal-600)); }
  .app-tab .fb-right-badge { position: absolute; top: 6px; left: calc(50% + 6px); }

  /* ---- Chat en modo app: dos pantallas ---- */
  html.app-movil .pagina-chat .chat-intro { display: none; }
  html.app-movil .chat-layout { display: block; }
  html.app-movil .pagina-chat:not(.con-conversacion) .chat-conversacion { display: none; }
  html.app-movil .pagina-chat:not(.con-conversacion) .chat-lista { width: 100%; max-height: none; box-shadow: none; border: none; background: transparent; }
  html.app-movil .chat-contacto { padding: .75rem .4rem; font-size: 1rem; border-bottom: 1px solid var(--border-soft); }
  html.app-movil .chat-contacto .post-avatar { width: 44px !important; height: 44px !important; font-size: 1.05rem !important; }
  html.app-movil .chat-lista-titulo { padding-left: .4rem; }
  html.app-movil .chat-solicitud, html.app-movil .chat-directorio-fila { padding: .55rem .4rem; }
  html.app-movil .pagina-chat.con-conversacion .chat-lista { display: none; }
  html.app-movil body.pagina-chat.con-conversacion { overflow: hidden; overscroll-behavior: none; }
  html.app-movil body.pagina-chat.con-conversacion :is(.fb-topbar, .app-tabbar) { display: none; }
  html.app-movil .pagina-chat.con-conversacion .chat-conversacion {
    position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-alto, 100dvh); z-index: 50;
    margin: 0; border-radius: 0; border: none; box-shadow: none; padding: 0; background: #f0f2f5;
  }
  html.app-movil .chat-conv-header { margin: 0; padding: .5rem .6rem; padding-top: max(.5rem, env(safe-area-inset-top)); background: var(--t-barra, #fff);
    border-bottom: 1px solid rgba(15,23,42,.1); flex-shrink: 0; gap: .55rem; }
  html.app-movil .chat-conv-header .post-autor { font-size: 1.02rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
  html.app-movil .chat-conv-header #chat-vaciar { margin-left: 0 !important; padding: .35rem .55rem; font-size: 0; }
  html.app-movil .chat-conv-header #chat-vaciar::before { content: '🗑'; font-size: 1.05rem; }
  html.app-movil .chat-conv-mensajes { padding: .7rem .75rem; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  html.app-movil .chat-burbuja { max-width: 80%; box-shadow: 0 1px 1px rgba(0,0,0,.06); background: #fff; }
  html.app-movil .chat-burbuja.mio { background: #d9fdd3; }
  html.app-movil .chat-burbuja.chat-burbuja-emoji { box-shadow: none; background: none; }
  html.app-movil .chat-burbuja p { font-size: .97rem; }
  html.app-movil .chat-adjunto-img { max-width: 100%; }
  /* En celular las acciones salen DENTRO de la burbuja al tocarla (a los
     lados no caben y arriba las corta el borde de la conversacion) */
  html.app-movil .chat-acciones { display: none; position: relative; top: auto; left: auto; right: auto; transform: none; opacity: 1; pointer-events: auto;
    order: 99; justify-content: flex-end; gap: .2rem; margin: .35rem -.3rem -.1rem; padding-top: .3rem; border-top: 1px solid rgba(15,23,42,.08); }
  html.app-movil .chat-burbuja { display: flex; flex-direction: column; }
  html.app-movil .chat-burbuja.tocada .chat-acciones { display: flex; }
  html.app-movil .chat-burbuja.mio .chat-acciones { flex-direction: row; }
  html.app-movil .chat-acciones button { font-size: 1.1rem; padding: .3rem .6rem; background: rgba(15,23,42,.05); border-radius: 999px; }
  html.app-movil .chat-acciones .chat-reenviar-popup { top: auto; bottom: calc(100% + 4px); right: 0; }
  html.app-movil .chat-burbuja.tocada { box-shadow: 0 0 0 2px rgba(13,148,136,.35); }
  /* El panel con desenfoque (backdrop-filter) y las animaciones con
     transform convierten a position:fixed en "relativo al panel": en la
     conversacion se quitan para que de verdad ocupe toda la pantalla. */
  html.app-movil body.pagina-chat.con-conversacion :is(.main-panel, main, .fb-body, .card) { backdrop-filter: none; -webkit-backdrop-filter: none; transform: none; animation: none; filter: none; }
  html.app-movil .chat-respondiendo { background: #f0f2f5; padding: .4rem .6rem 0; }
  html.app-movil .chat-respondiendo .chat-cita { background: #fff; }
  html.app-movil .chat-conv-form { margin: 0; padding: .45rem .5rem; padding-bottom: max(.45rem, env(safe-area-inset-bottom)); border-top: none; background: #f0f2f5; gap: .35rem; flex-shrink: 0; align-items: center; }
  html.app-movil .chat-conv-form input[type=text] { min-width: 0; padding: .6rem .9rem; border: none; background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
  html.app-movil .chat-conv-form .btn-enviar { width: 44px; height: 44px; padding: 0; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
  html.app-movil .chat-conv-form .btn-enviar span { display: none; }
  html.app-movil .chat-conv-form .btn-enviar svg { display: block; }
  html.app-movil .chat-emoji-popup { position: fixed; left: 8px; right: 8px; bottom: 64px; width: auto; max-width: none; }
  .chat-volver { display: none; }
  html.app-movil .chat-volver { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin-left: -.2rem; color: var(--text); text-decoration: none; border-radius: 50%; flex-shrink: 0; }
  html.app-movil .chat-volver:active { background: rgba(15,23,42,.08); }
  .chat-conv-form .btn-enviar svg { display: none; }
  .chat-conv-adjuntar { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.15rem; padding: .2rem .3rem; flex-shrink: 0; }

  .aviso-flotante { position: fixed; top: 64px; right: 16px; z-index: 120; width: min(360px, calc(100vw - 24px)); background: #fff; color: var(--text);
    text-decoration: none; border-radius: 14px; box-shadow: 0 10px 34px -6px rgba(0,0,0,.35); padding: .7rem .95rem; display: flex; flex-direction: column; gap: .1rem;
    transform: translateY(-140%); opacity: 0; transition: transform .3s ease, opacity .3s ease; border-left: 4px solid var(--teal-600); }
  .aviso-flotante.visible { transform: none; opacity: 1; }
  .aviso-flotante b { font-size: .9rem; }
  .aviso-flotante span { font-size: .82rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .aviso-instalar { position: fixed; left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 96; background: #0f172a; color: #fff;
    border-radius: 14px; padding: .75rem .9rem; display: flex; gap: .6rem; align-items: flex-start; box-shadow: 0 10px 30px rgba(0,0,0,.35); font-size: .85rem; }
  .aviso-instalar > div { flex: 1; display: flex; flex-direction: column; gap: .2rem; }
  .aviso-instalar span { color: #cbd5e1; line-height: 1.4; }
  .aviso-instalar span b { color: #fff; }
  .aviso-instalar svg { vertical-align: -2px; }
  .aviso-instalar button { background: none; border: none; color: #94a3b8; font-size: 1rem; padding: .1rem .3rem; cursor: pointer; }
  html.app-movil .aviso-flotante { top: max(8px, env(safe-area-inset-top)); left: 12px; right: 12px; width: auto; }

  /* Titulo de la conversacion: en celular es el boton de minimizar */
  .chat-conv-titulo { display: flex; align-items: center; gap: .7rem; background: none; border: none; padding: 0; font: inherit; color: inherit; cursor: default; min-width: 0; text-align: left; }
  .chat-minimizar-icono { display: none; }
  html.app-movil .chat-conv-titulo { flex: 1; cursor: pointer; border-radius: 10px; padding: .15rem .3rem; margin-left: -.3rem; }
  html.app-movil .chat-conv-titulo:active { background: rgba(15,23,42,.07); }
  html.app-movil .chat-minimizar-icono { display: block; flex-shrink: 0; color: var(--text-faint); }

  /* Burbuja flotante de chat minimizado (estilo Messenger), solo celular */
  .chat-cabeza { position: fixed; z-index: 95; width: 58px; height: 58px; touch-action: none; user-select: none; -webkit-user-select: none;
    transition: left .25s cubic-bezier(.3,1.4,.6,1), top .05s linear; animation: cabeza-entra .35s cubic-bezier(.34,1.56,.64,1) both; }
  .chat-cabeza.arrastrando { transition: none; }
  .chat-cabeza-circulo { width: 58px; height: 58px; border-radius: 50%; background: linear-gradient(135deg, #0d9488, #2563eb); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.45rem; box-shadow: 0 6px 20px rgba(0,0,0,.3); border: 3px solid #fff; cursor: pointer; }
  .chat-cabeza .fb-right-badge { position: absolute; top: -2px; right: -2px; border: 2px solid #fff; min-width: 22px; height: 22px; font-size: .74rem; }
  .chat-cabeza-x { position: absolute; top: -6px; left: -6px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; background: #374151; color: #fff;
    font-size: .72rem; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
  .chat-cabeza.arrastrando .chat-cabeza-x { opacity: 0; }
  @keyframes cabeza-entra { from { transform: scale(.2); opacity: 0; } to { transform: none; opacity: 1; } }
  .chat-cabeza.saliendo { transform: scale(.2); opacity: 0; transition: transform .2s ease, opacity .2s ease; }

  /* ---- Impresion / exportar PDF: el chrome del portal (barra superior
     sticky, menus laterales fixed) no debe aparecer en el PDF -- sin esto,
     Chrome repinta la barra sticky sobre el contenido en cada pagina
     impresa. ---- */
  @media print {
    .fb-topbar, .fb-left, .fb-right, .drawer-overlay { display: none !important; }
    main.con-izq, main.con-der { margin-left: 0 !important; margin-right: 0 !important; }
  }
