/* =========================
   Variables y base
   ========================= */
:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #6b7280;
  --line: #e9e9ed;
  --chip: #f2f2f2;
  --brand: #0f62fe;
  --shadow: 0 2px 8px rgba(0, 0, 0, .06);

  /* Pills por categoría */
  --pill-opinion-bg: #444444;
  --pill-opinion-fg: #ffffff;
  --pill-analisis-bg: #004F6D;
  --pill-analisis-fg: #ffffff;
  --pill-pregunta-bg: #3BB18A;
  --pill-pregunta-fg: #ffffff;
  --pill-noticias-bg: #C5A241;
  --pill-noticias-fg: #ffffff;

  /* Zona segura (notch) + tamaños */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --topbar-h: 56px;

  /* margen extra visible arriba */
  --top-extra: 4px;
}

.link-author {
  text-decoration: none;
  color: black;
}


* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Playfair Display', serif;
  color: var(--text);
  background: var(--bg);
}

/* =========================
   Feed
   ========================= */
#feed {
  padding: 8px 12px 96px;
}

.post {
  padding: 14px 0;
  background: #fff;
}

.post-row {
  display: grid;
  grid-template-columns: 1fr auto;
  /* sitio opcional para thumbnail */
  align-items: center;
  gap: 8px;
}

/* Cabecera: pill + autor */
.post-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
}

.pill--opinion {
  background: var(--pill-opinion-bg);
  color: var(--pill-opinion-fg);
}

.pill--analisis {
  background: var(--pill-analisis-bg);
  color: var(--pill-analisis-fg);
}

.pill--pregunta {
  background: var(--pill-pregunta-bg);
  color: var(--pill-pregunta-fg);
}

.pill--noticias {
  background: var(--pill-noticias-bg);
  color: var(--pill-noticias-fg);
}

.meta-author {
  font-size: 13px;
  color: var(--muted);
}

/* Título + snippet */
.post-title {
  margin: 2px 0 6px;
  font-weight: 500;
  font-size: 15px;
  color: var(--text);
}

.post-snippet {
  margin: 0 0 10px;
  font-size: 15px;
  color: #4b5563;
}

/* Miniatura opcional a la derecha */
.post-thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  margin-left: 12px;
  box-shadow: var(--shadow);
}

/* Pie: contadores + CTA */
.post-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.counters {
  display: flex;
  align-items: center;
  gap: 18px;
  font-weight: 600;
  color: var(--text);
}

.counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  background: none;
  border: 0;
  cursor: pointer;
}

.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  color: var(--text);
}

.cta-like {
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  opacity: .75;
}

.cta-like:hover {
  opacity: 1;
}

/* =========================
   Encuestas (poll)
   ========================= */
.poll button {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  margin: 6px 0;
  cursor: pointer;
}

.poll button:active {
  transform: scale(.99);
}

/* =========================
   Botón flotante (nueva publicación)
   ========================= */
#boton-flotante {
  position: fixed;
  right: 16px;
  bottom: 100px;
  z-index: 15;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  color: #fff;
  border: 0;
  font-size: 22px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 0.093rem solid black;
}

/* =========================
   Modales reutilizables
   ========================= */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .5);
  z-index: 20;
}

.modal-contenido {
  width: 92%;
  max-width: 520px;
  max-height: 80vh;
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.modal h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.modal ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.modal ul li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.modal input,
.modal select,
.modal textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  padding: 10px;
  margin-top: 8px;
}

.modal textarea {
  min-height: 100px;
  resize: vertical;
}

/* Estado oculto */
.oculto {
  display: none;
}

/* =========================
   Responsivo
   ========================= */
@media (min-width: 768px) {
  #feed {
    padding: 12px 24px 100px;
  }

  .post-title {
    font-size: 22px;
  }
}

/* =========================
   Topbar pro
   ========================= */
:root {
  --topbar-bg: rgba(255, 255, 255, .85);
  --topbar-blur: 10px;
  --topbar-shadow: 0 2px 10px rgba(0, 0, 0, .06);
  --icon-size: 22px;
  --chip-bg: #f4f4f6;
  --chip-text: #111;
  --chip-active-bg: #0f62fe;
  --chip-active-text: #fff;
  --chip-border: rgba(17, 17, 17, .08);
}

/* ================= Topbar centrado pro ================= */
:root {
  --line: #e9e9ed;
}





.tb-left {
  width: 40px;
  height: 40px;
}

.tb-right {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.tb-right img {
  width: 22px;
  height: 22px;
  display: block;
}

.tb-title {
  margin: 0;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .2px;
}

/* ================= Hoja de notificaciones ================= */
.sheet {
  position: fixed;
  inset: 0 0 0 0;
  background: #fff;
  z-index: 60;
  display: flex;
  flex-direction: column;
}

.sheet.oculto {
  display: none;
}

.sheet-topbar {
  position: block;
  top: 0;
  z-index: 2;
  display: ruby;
  align-items: center;

  min-height: calc(var(--topbar-h) + var(--safe-top) + var(--top-extra));
  padding: calc(8px + var(--safe-top) + var(--top-extra)) 12px 10px;

  border-bottom: 1px solid var(--line);
  background: #fff;
}


.sheet-topbar h2 {
  margin: 0;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
}

.back-btn {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.spacer {
  width: 40px;
  height: 40px;
}

.notif-list {
  padding: 8px 0;
}

.notif-item {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
}

.notif-item+.notif-item {
  border-top: 1px solid var(--line);
}

.notif-avatar,
.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.notif-body h4 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 800;
  color: #111;
}

.notif-body p {
  margin: 0;
  font-size: 14px;
  color: #4b5563;
}

.notif-meta {
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
}

.chev {
  width: 14px;
  height: 14px;
}

/* Estado no leído (negrita ligera) */
.notif-item.unread .notif-body h4 {
  font-weight: 900;
}


.top-icons {
  display: inline-flex;
  gap: 8px;
}

.top-icons button {
  appearance: none;
  border: 1px solid var(--chip-border);
  background: #fff;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: var(--icon-size);
  line-height: 0;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}

.top-icons button:active {
  transform: scale(.97);
}

.top-icons button:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
  background: #fafafa;
}

.top-icons button:focus-visible {
  outline: 2px solid #0f62fe55;
  outline-offset: 2px;
}

/* =========================
   Categorías (chips scrollables)
   ========================= */
#categorias {
  position: sticky;
  top: calc(var(--topbar-h) + var(--safe-top) + var(--top-extra));
  z-index: 40;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, .05);
  scroll-snap-type: x proximity;
}

/* ocultar scrollbars de forma elegante */
#categorias::-webkit-scrollbar {
  height: 0;
}

#categorias {
  scrollbar-width: none;
}

#categorias button {
  scroll-snap-align: start;
  white-space: nowrap;
  appearance: none;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--chip-text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .2px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .08s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03) inset;
}

#categorias button:hover {
  background: #ececf1;
}

#categorias button:active {
  transform: translateY(1px);
}

#categorias button:focus-visible {
  outline: 2px solid #0f62fe55;
  outline-offset: 2px;
}

/* estado activo */
#categorias button.activo {
  background: var(--chip-active-bg);
  color: var(--chip-active-text);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(15, 98, 254, .25);
}

/* =========================
   Modo oscuro opcional
   ========================= */
@media (prefers-color-scheme: dark) {
  :root {
    --topbar-bg: rgba(18, 18, 18, .7);
    --chip-bg: #1f1f22;
    --chip-text: #e7e7ea;
    --chip-border: rgba(255, 255, 255, .08);
  }

  #topbar h1 {
    color: #f5f5f7;
  }

  .top-icons button {
    background: #1d1d1f;
    border-color: var(--chip-border);
    color: #f5f5f7;
  }

  .top-icons button:hover {
    background: #242427;
  }

  #categorias {
    background: #161618;
    border-bottom-color: rgba(255, 255, 255, .06);
  }

  #categorias button {
    color: var(--chip-text);
    background: var(--chip-bg);
  }
}

/* ===== Toolbar (buscador + filtrar) ===== */

.toolbar-wrap {
  position: sticky;
  top: calc(var(--topbar-h) + var(--safe-top) + var(--top-extra));
  z-index: 40;
  background: #fff;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px 12px;
}

/* Botón Filtros */
.filter-btn {
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #111;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow .15s ease, transform .08s ease, background .15s ease;
}

.filter-btn:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
  background: #fafafa;
}

.filter-btn:active {
  transform: scale(.98);
}

/* Panel de filtros */
.filter-panel {
  position: relative;
  overflow: hidden;
  border-top: 1px solid #e9e9ed;
  border-bottom: 1px solid #e9e9ed;
  background: #fff;

  /* Animación: se despliega desde arriba-derecha y hacia abajo */
  transform-origin: top right;
  transform: scaleY(0);
  opacity: 0;
  max-height: 0;
  transition: transform .22s ease, opacity .22s ease, max-height .22s ease;
}

.filter-panel.open {
  transform: scaleY(1);
  opacity: 1;
  max-height: 420px;
  /* altura máxima del panel */
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 12px;
}

.filter-group h4 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #6b7280;
}

.filter-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  padding: 6px 0;
  cursor: pointer;
}

.filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px dashed #eceff3;
}

.btn {
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #111;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.btn.primary {
  background: white;
  border: 1px solid #111;
  color: black;
}

.btn.ghost:hover {
  background: #f7f7f9;
}

/* ====== Hoja de detalle ====== */
.sheet {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 60;
  display: flex;
  flex-direction: column;
}

.sheet.oculto {
  display: none;
}

.sheet-topbar h2 {
  margin: 0;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .8px;
}

.back-btn {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  font-size: 28px;
  cursor: pointer;
}

.spacer {
  width: 40px;
  height: 40px;
}

/* Contenido */
.post-detail {
  padding: 12px 14px 88px;
}

/* deja hueco para composer */
.detail-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.detail-title {
  font-size: 17px;
  font-weight: 600;
  margin: 6px 0 20px;
  color: #111;
}

/* Autor + tiempo */
.detail-author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: #6b7280;
  font-size: 14px;
}

.detail-author img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.detail-author .name {
  color: #111;
  font-weight: 700;
}

.detail-author .dot {
  margin: 0 6px;
  opacity: .4;
}

/* Cuerpo */
.detail-body {
  font-size: 15px;
  color: #374151;
  margin-bottom: 10px;
  text-align: justify;
}

/* Comentarios */
.comments {
  margin-top: 8px;
}

.comment {
  display: flex;
  gap: 10px;
  padding: 12px 0;
}

.comment:first-child {
  border-top: 0;
}

.comment .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.comment .c-body {
  flex: 1;
}

.comment .c-head {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 4px;
}

.comment .c-name {
  color: #111;
  font-weight: 700;
}

.comment .c-text {
  margin: 0;
  font-size: 15px;
  color: #374151;
}

.c-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 6px;
  font-size: 13px;
  color: #111;
}

.c-actions .icon {
  width: 16px;
  height: 16px;
}

/* Composer (input abajo) */
.composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 80px;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
  padding: 8px 12px calc(8px + var(--safe-bottom));
  border-top: 1px solid #e9e9ed;
  background: #fff;
}

.composer input {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 15px;
  background: #f7f8fa;
}

.composer button {
  border: 0;
  border-radius: 14px;
  background: #0f62fe;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

/* Pills por categoría (reutiliza tu paleta) */
.detail-pill.opinion {
  background: #2f6fed;
  color: #fff;
}

.detail-pill.analisis {
  background: #2ea44f;
  color: #fff;
}

.detail-pill.pregunta {
  background: #7e57c2;
  color: #fff;
}

.detail-pill.noticias {
  background: #ffe58a;
  color: #574300;
}

/* Tick al lado del autor en detalle */
.tick-icon {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  margin-left: 4px;
  object-fit: contain;
}

.avatar-inicial {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #4b5563;
  /* gris oscuro, puedes cambiarlo */
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
}

.tg {
  object-fit: contain;
  vertical-align: middle;
  margin-left: 5px;
}

.tb {
  object-fit: contain;
  vertical-align: middle;
  margin-left: 5px;
}

/* ===== Modal comentarios: layout compacto en fila ===== */
#modal-comentarios .modal-contenido {
  display: grid;
  grid-template-columns: 1fr auto auto;
  /* contenido + dos columnas para botones */
  gap: 8px;
  align-items: center;
}

/* Título, lista e input ocupan todo el ancho */
#modal-comentarios .modal-contenido>h3,
#modal-comentarios .modal-contenido>#comentarios-lista,
#modal-comentarios .modal-contenido>#nuevo-comentario {
  grid-column: 1 / -1;
}

/* Botones compactos */
#modal-comentarios .modal-contenido button {
  appearance: none;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  /* más pequeños */
  font: 600 13px/1 system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
  cursor: pointer;
  transition: transform .04s, box-shadow .18s, background-color .18s, color .18s;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .06), 0 2px 10px rgba(0, 0, 0, .06);
  user-select: none;
  width: auto !important;
  /* asegura que no se estiren en móvil */
}

/* Colocar cada botón en su columna (2 y 3) */
#modal-comentarios .modal-contenido button:nth-of-type(1) {
  grid-column: 2;
}

#modal-comentarios .modal-contenido button:nth-of-type(2) {
  grid-column: 3;
}

/* Colores (mismo estilo que te gustó) */
#modal-comentarios .modal-contenido button[onclick^="enviarComentario"] {
  background: #111;
  color: #fff;
}

#modal-comentarios .modal-contenido button[onclick^="enviarComentario"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .08), 0 6px 18px rgba(0, 0, 0, .12);
}

#modal-comentarios .modal-contenido button[onclick^="enviarComentario"]:active {
  transform: translateY(0);
  box-shadow: none;
}

#modal-comentarios .modal-contenido button[onclick^="enviarComentario"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, .18), 0 2px 10px rgba(0, 0, 0, .12);
}

#modal-comentarios .modal-contenido button[onclick^="cerrarModal"] {
  background: #fff;
  color: #111;
  border: 1px solid rgba(0, 0, 0, .15);
}

#modal-comentarios .modal-contenido button[onclick^="cerrarModal"]:hover {
  background: rgba(0, 0, 0, .03);
  border-color: rgba(0, 0, 0, .25);
}

#modal-comentarios .modal-contenido button[onclick^="cerrarModal"]:active {
  background: rgba(0, 0, 0, .06);
}

#modal-comentarios .modal-contenido button[onclick^="cerrarModal"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, .12);
}

/* Accesibilidad y estado */
#modal-comentarios .modal-contenido button:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* === Botones del modal "Crear publicación" === */
#modal-nuevo-post .modal-contenido {
  /* no cambiamos layout, solo alineamos la fila de botones a la derecha */
  text-align: right;
}

#modal-nuevo-post .modal-contenido> :not(button) {
  /* el resto del contenido mantiene alineación natural */
  text-align: left;
}

/* base */
#modal-nuevo-post .modal-contenido button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .6rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line, #e5e7eb);
  background: var(--card, #fff);
  color: var(--text, #0f172a);
  font-weight: 700;
  letter-spacing: .2px;
  cursor: pointer;
  transition: transform .06s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
  user-select: none;
}

/* espacio entre ellos */
#modal-nuevo-post .modal-contenido button+button {
  margin-left: .5rem;
}

/* primario (el primero: Publicar) */
#modal-nuevo-post .modal-contenido button:first-of-type {
  background: #111111;
  color: #fff;
  border-color: #111111;
}

#modal-nuevo-post .modal-contenido button:first-of-type:hover {
  filter: brightness(.97);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .10);
}

#modal-nuevo-post .modal-contenido button:first-of-type:active {
  transform: translateY(1px);
}

/* secundario fantasma (Cancelar) */
#modal-nuevo-post .modal-contenido button:last-of-type {
  background: transparent;
  color: var(--text, #0f172a);
  border-color: var(--line, #e5e7eb);
}

#modal-nuevo-post .modal-contenido button:last-of-type:hover {
  background: rgba(0, 0, 0, .04);
}

@media (prefers-color-scheme: dark) {
  #modal-nuevo-post .modal-contenido button:last-of-type:hover {
    background: rgba(255, 255, 255, .06);
  }
}

/* estados de accesibilidad */
#modal-nuevo-post .modal-contenido button:focus-visible {
  outline: 2px solid var(--accent, #0ea5e9);
  outline-offset: 2px;
}

/* deshabilitado (por si alguna vez lo usas) */
#modal-nuevo-post .modal-contenido button:disabled {
  opacity: .6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* tamaño cómodo en móvil */
@media (max-width: 480px) {
  #modal-nuevo-post .modal-contenido button {
    padding: .55rem .9rem;
    border-radius: 10px;
  }
}

/* ===== Detalle de publicación (sheet) ===== */


/* Área scrolleable del detalle */
#post-detail {
  flex: 1;
  /* ocupa todo el alto disponible */
  overflow: auto;
  /* <- habilita scroll vertical */
  -webkit-overflow-scrolling: touch;
  /* inercia en iOS */
  overscroll-behavior: contain;
  /* evita “arrastrar” el body al llegar al borde */
  padding: 16px 16px 96px;
  /* último valor = margen inferior para que no tape el composer */
}

/* Topbar del sheet fijo arriba */
#sheet-post .sheet-topbar {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Composer pegado abajo */
#sheet-post .composer {
  position: sticky;
  /* queda visible sin sacarlo del flujo */
  bottom: 80px;
  padding: 10px 12px;
  background: inherit;
  /* mismo fondo que el sheet */
  border-top: 1px solid rgba(255, 255, 255, .08);
  z-index: 1;
}

.avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* ===== YouTube: wrapper responsivo ===== */
.video-embed iframe {
  inset: 0;
  width: auto;
  height: 100%;
  border: 0;
  display: block;
  pointer-events: auto;
  /* el click va al reproductor */
  align-items: center;
  margin-bottom: 15px;
  border: 5px solid black;
}



/* ======= Share button ======= */
.counter.share-btn {
  opacity: .9
}

.counter.share-btn:active {
  transform: scale(.98);
}

/* ======= Share sheet (fallback) ======= */
.share-app {
  display: grid;
  place-items: center;
  gap: 6px;
  text-decoration: none;
  color: #111;
  font-weight: 700;
  font-size: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 6px;
  box-shadow: var(--shadow);
}

.share-app img,
.share-app svg {
  width: 36px;
  height: 36px;
  display: block;
}

.share-app:active {
  transform: scale(.98);
}

@media (prefers-color-scheme: dark) {
  .share-app {
    background: #1d1d1f;
    border-color: rgba(255, 255, 255, .08);
    color: #f5f5f7;
  }
}

:root {
  /* altura fija para calcular el offset de la toolbar sticky */
  --tabs-h: 44px;
}

/* ===== Pestañas feed (sticky bajo la topbar) ===== */
.feed-tabs {
  position: sticky;
  top: calc(var(--topbar-h) + var(--safe-top) + var(--top-extra));

  display: grid;
  grid-auto-flow: column;
  gap: 8px;
  align-items: center;

  background: #fff;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, .06);
}


.feed-tabs .tab {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 10px 12px;
  font-weight: 800;
  font-size: 14px;
  color: #6b7280;
  border-radius: 12px;
  cursor: pointer;
  position: relative;
}

.feed-tabs .tab.is-active {
  color: #111;
}

/* La toolbar va pegada debajo de las tabs: sumamos su altura al offset */
.toolbar-wrap {
  top: calc(var(--topbar-h) + var(--safe-top) + var(--top-extra) + var(--tabs-h));
}

/* ===== PERFIL PÚBLICO — Versión clara moderna ===== */
.perfil-light {
  background: #fff;
  border-radius: 16px;
  width: 92%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  color: #111;
  position: relative;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .1);
}

.perfil-cerrar {
  position: absolute;
  top: 14px;
  right: 14px;
  background: #f2f2f2;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: background .15s;
}

.perfil-cerrar:hover {
  background: #e9e9e9;
}

.perfil-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: #f5f5f5;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 26px;
  color: #111;
}

.perfil-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.perfil-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.perfil-nombre-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.perfil-nombre {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

#perfil-tick svg {
  width: 20px;
  height: 20px;
  vertical-align: middle;
}

.perfil-cartera {
  margin: 2px 0 0;
  font-size: 14px;
  color: #6b7280;
}

.perfil-bio {
  font-size: 15px;
  color: #4b5563;
  margin: 12px 0;
}

.perfil-tabs {
  display: flex;
  justify-content: space-around;
  margin-bottom: 12px;
  border-bottom: 1px solid #e9e9ed;
}

.perfil-tab {
  flex: 1;
  text-align: center;
  background: none;
  border: none;
  padding: 10px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s;
}

.perfil-tab:hover {
  background: #f9f9f9;
}

.perfil-tab.activo {
  border-bottom: 3px solid #111;
  color: #111;
}

.perfil-contenido {
  overflow-y: auto;
  max-height: 60vh;
}

.perfil-lista {
  list-style: none;
  margin: 0;
  padding: 0;
}

.perfil-lista li {
  padding: 10px 0;
  border-bottom: 1px solid #e9e9ed;
  font-size: 15px;
}

.perfil-lista li:first-child {
  font-weight: 700;
}

.perfil-lista a {
  text-decoration: none;
  color: #111;
}

.perfil-lista a:hover {
  text-decoration: underline;
}

/* ===== PERFIL PÚBLICO — Versión clara FULLSCREEN ===== */
#modal-perfil .modal-contenido.perfil-light {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border-radius: 0;
  background: #fff;
  color: #111;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: none;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  /* header, bio, tabs, contenido */
  gap: 10px;
}

#modal-perfil .perfil-cerrar {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  right: 12px;
  z-index: 2;
}

#modal-perfil .perfil-header {
  position: sticky;
  top: calc(4px + env(safe-area-inset-top));
  background: #fff;
  padding-bottom: 10px;
  border-bottom: 1px solid #e9e9ed;
  z-index: 1;
}

#modal-perfil .perfil-tabs {
  position: sticky;
  top: calc(80px + env(safe-area-inset-top));
  /* queda bajo el header */
  background: #fff;
  border-bottom: 1px solid #e9e9ed;
  z-index: 1;
}

#modal-perfil .perfil-contenido {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
  /* margen para último ítem */
}

/* grid simple de cartera en claro */
.perfil-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.perfil-card {
  border: 1px solid #e9e9ed;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .04);
}

.perfil-card h4 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 800;
}

.perfil-card .meta {
  font-size: 13px;
  color: #6b7280;
}

@media (max-width: 560px) {
  .perfil-grid {
    grid-template-columns: 1fr;
  }
}

/* === PERFIL PÚBLICO — FULLSCREEN BLANCO DELANTE DE TODO === */
#modal-perfil {
  position: fixed;
  inset: 0;
  background: #fff;
  /* z-index: 9999 !important; /* 👈 siempre encima de todo */
  display: grid;
  place-items: stretch;
  transition: opacity .25s ease;
  opacity: 0;
  pointer-events: none;
}

#modal-perfil:not(.oculto) {
  opacity: 1;
  pointer-events: auto;
}

#modal-perfil .modal-contenido.perfil-light {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  background: #fff;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 10px;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
  overflow: hidden;
  animation: perfilFadeIn .25s ease-out both;
}

@keyframes perfilFadeIn {
  from {
    opacity: 0;
    transform: scale(.98);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* === CABECERA === */
#modal-perfil .perfil-cerrar {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: 14px;
  z-index: 10000;
  border: none;
  background: #f2f2f2;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  transition: background .15s;
}

#modal-perfil .perfil-cerrar:hover {
  background: #e9e9e9;
}

#modal-perfil .perfil-header {
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid #e9e9ed;
  padding-bottom: 10px;
  margin-top: 40px;
}

#modal-perfil .perfil-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: #f4f4f4;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 26px;
  color: #111;
}

#modal-perfil .perfil-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#modal-perfil .perfil-info {
  flex: 1;
}

#modal-perfil .perfil-nombre-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

#modal-perfil .perfil-nombre {
  font-size: 22px;
  font-weight: 800;
  margin: 0;
}

#perfil-tick svg {
  width: 20px;
  height: 20px;
  vertical-align: middle;
}

#modal-perfil .perfil-cartera {
  font-size: 14px;
  color: #6b7280;
  margin-top: 2px;
}

#modal-perfil .perfil-bio {
  font-size: 15px;
  color: #4b5563;
}

/* === PESTAÑAS === */
#modal-perfil .perfil-tabs {
  display: flex;
  justify-content: space-around;
  border-bottom: 1px solid #e9e9ed;
}

#modal-perfil .perfil-tab {
  flex: 1;
  text-align: center;
  background: none;
  border: none;
  padding: 10px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s;
}

#modal-perfil .perfil-tab:hover {
  background: #f8f8f8;
}

#modal-perfil .perfil-tab.activo {
  border-bottom: 3px solid #111;
  color: #111;
}

/* === CONTENIDO === */
#modal-perfil .perfil-contenido {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 20px;
}

.perfil-lista {
  list-style: none;
  margin: 0;
  padding: 0;
}

.perfil-lista li {
  padding: 10px 0;
  border-bottom: 1px solid #e9e9ed;
  font-size: 15px;
}

.perfil-lista li:first-child {
  font-weight: 700;
}

.perfil-lista a {
  color: #111;
  text-decoration: none;
}

.perfil-lista a:hover {
  text-decoration: underline;
}

/* === CARTERA GRID === */
.perfil-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.perfil-card {
  border: 1px solid #e9e9ed;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .04);
}

.perfil-card h4 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 800;
}

.perfil-card .meta {
  font-size: 13px;
  color: #6b7280;
}

@media (max-width: 560px) {
  .perfil-grid {
    grid-template-columns: 1fr;
  }
}

/* === Flecha de volver en el perfil fullscreen === */
#modal-perfil .perfil-volver {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: 14px;
  z-index: 10000;
  appearance: none;
  background: #f2f2f2;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s, transform .1s;
}

#modal-perfil .perfil-volver:hover {
  background: #e6e6e6;
}

#modal-perfil .perfil-volver:active {
  transform: scale(0.95);
}

#modal-perfil .perfil-volver svg {
  width: 22px;
  height: 22px;
  color: #111;
}

/* ===== Acciones compactas en lista de publicaciones ===== */
.perfil-actions {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  margin-top: 6px;
}

.mini-counter {
  appearance: none;
  background: transparent;
  border: 1px solid #e9e9ed;
  border-radius: 999px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #111;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .06s;
}

.mini-counter:active {
  transform: scale(.98);
}

.mini-counter.is-liked {
  background: #111;
  color: #fff;
  border-color: #111;
}

.mini-counter .icon {
  width: 16px;
  height: 16px;
}

/* ===== Tarjetas de cartera con imagen ===== */
.perfil-card .card-media {
  width: 100%;
  aspect-ratio: 16/10;
  border-radius: 10px;
  overflow: hidden;
  background: #f5f5f7;
  margin-bottom: 8px;
  border: 1px solid #e9e9ed;
}

.perfil-card .card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.perfil-card .img-ph {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #9aa0a6;
  font-weight: 700;
  font-size: 12px;
}

/* ===== PERFIL: feed de publicaciones en tarjetas ===== */
.perfil-feed {
  display: grid;
  gap: 10px;
  padding: 4px 0 8px;
}

/* Reusa .post del feed pero con microajustes en el perfil */
#modal-perfil .perfil-feed .post {
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  padding: 10px 12px;
  background: #fff;
}

#modal-perfil .perfil-feed .post:hover {
  background: #fafafa;
}

/* Compacta cabecera y título en el perfil */
#modal-perfil .perfil-feed .post .post-head {
  margin-bottom: 6px;
}

#modal-perfil .perfil-feed .post .post-title {
  margin: 4px 0 6px;
}

/* Barra de acciones: like, comentarios, compartir (ya existe .counter) */
#modal-perfil .perfil-feed .post .post-foot {
  margin-top: 8px;
}

#modal-perfil .perfil-feed .post .counters {
  display: grid;
  grid-auto-flow: column;
  justify-content: start;
  gap: 14px;
}

/* Botón compartir ya tenía estilos base */
/* ====== Cartera (mismo look que perfil privado) ====== */
.cartera-card {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 12px;
  border: 1px solid #e9e9ed;
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .04);
}

@media (max-width: 560px) {
  .cartera-card {
    grid-template-columns: 1fr;
  }
}

.cartera-card .card-main {
  display: grid;
  gap: 10px;
}

.cartera-card .card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.cartera-card .codigo {
  font-weight: 900;
  letter-spacing: .3px;
  font-size: 15px;
}

.cartera-card .badges {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cartera-card .badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid #e5e7eb;
  background: #f7f8fa;
  color: #111;
}

.cartera-card .badge.rent {
  border-color: #111;
}

.cartera-card .badge.plazo {}

.cartera-card .badge.divisa {}

.cartera-card .card-body {
  display: grid;
  gap: 10px;
}

.cartera-card .importe {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.cartera-card .importe .label {
  font-size: 12px;
  color: #6b7280;
}

.cartera-card .importe .value {
  font-size: 16px;
  font-weight: 900;
}

.cartera-card .progress {
  display: grid;
  gap: 6px;
}

.cartera-card .progress-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #6b7280;
}

.cartera-card .progress-bar {
  height: 8px;
  border: 1px solid #e9e9ed;
  border-radius: 999px;
  overflow: hidden;
  background: #f7f7f9;
}

.cartera-card .progress-fill {
  height: 100%;
  background: #111;
}

.cartera-card .card-actions {
  display: flex;
  gap: 8px;
}

.cartera-card .btn {
  border: 1px solid #e5e7eb;
  background: #fff;
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.cartera-card .btn-link {
  border-color: #111;
  color: #111;
  text-decoration: none;
}

.cartera-card .card-media {
  width: 100%;
  aspect-ratio: 16/10;
  border-radius: 10px;
  overflow: hidden;
  background: #f5f5f7;
  border: 1px solid #e9e9ed;
}

.cartera-card .card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}


/* =========================
   Estilo minimalista tipo Apple
   ========================= */
:root {
  --bg: #ffffff;
  --text: #000000;
  --muted: #86868b;
  --line: rgba(0, 0, 0, 0.08);
  --accent: #007AFF;
  --radius: 18px;
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* =========================
   Topbar
   ========================= */

.tb-title {
  text-align: center;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.3px;
}

.tb-right svg {
  width: 22px;
  height: 22px;
  stroke: var(--text);
  opacity: 0.6;
  transition: opacity .2s ease;
}

.tb-right:hover svg {
  opacity: 1;
}

/* =========================
   Tabs (Tendencias / Siguiendo / Recientes)
   ========================= */
.feed-tabs {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 10px 0 6px;
  background: var(--bg);
}

.feed-tabs .tab {
  appearance: none;
  background: none;
  border: 0;
  font-weight: 600;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  transition: color .2s ease;
}

.feed-tabs .tab.is-active {
  color: black;
}

/* =========================
   Publicaciones (feed)
   ========================= */
#feed {
  padding: 20px 16px 120px;
  max-width: 720px;
  margin: 0 auto;
}

.post {
  background: #fff;
  padding: 18px 10px;
  transition: transform .1s ease;
}

.post:active {
  transform: scale(.99);
}

.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.meta-author {
  color: var(--muted);
  font-size: 14px;
}

.post-title {
  font-weight: 600;
  font-size: 17px;
  margin: 4px 0;
  color: var(--text);
}

.post-snippet {
  color: #444;
  font-size: 15px;
  line-height: 1.45;
  margin: 6px 0 10px;
}

.post-foot {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 6px;
}

.counter {
  background: none;
  border: 0;
  font-size: 15px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: color .2s ease;
}

.counter.is-liked {
  color: black;
}

.counter:hover {
  color: var(--text);
}

.icon {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

/* =========================
   Buscador y filtros
   ========================= */
.toolbar-wrap {
  background: var(--bg);
  position: sticky;
  top: 56px;
  z-index: 10;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px 14px;
}

.filter-btn {
  background: #f8f8f8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease;
}

.filter-btn:hover {
  background: #f0f0f0;
}

/* =========================
   Botón flotante
   ========================= */


/* =========================
   Modal estilo Apple
   ========================= */
.modal-contenido {
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  max-width: 460px;
  width: 92%;
  animation: fadeUp .25s ease;
}

@keyframes fadeUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal input,
.modal textarea,
.modal select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 15px;
  padding: 10px;
  margin-top: 10px;
  background: #f9f9fa;
  color: var(--text);
}

.modal button {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  margin-top: 12px;
  cursor: pointer;
  transition: background .2s ease;
}

.modal button:hover {
  background: #0066d6;
}

.modal button+button {
  background: #e5e5e5;
  color: #000;
}

/* =========================
   Adaptativo
   ========================= */
@media (min-width: 768px) {
  .post {
    padding: 24px 28px;
  }

  .post-title {
    font-size: 19px;
  }
}

/* ======= Header superior ======= */
.topbar.topbar--right {
  position: block;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding: calc(8px + var(--safe-top, 0px)) 14px 10px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

/* Grupo derecha */
.right-group {
  display: flex;
  align-items: center;
  gap: 12px;
}



/* Campana */
.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.icon-btn:hover {
  background: #f8f8f8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn svg {
  stroke: #111;
  opacity: 0.75;
}

.icon-btn:hover svg {
  opacity: 1;
}

/* FIX menú avatar por encima de todo */
header.topbar {
  z-index: 9999;
}

.avatar-menu-wrap {
  position: relative;
  z-index: 10000;
}

.avatar-menu {
  z-index: 10001;
  pointer-events: auto;
}

/* ======== Crear Publicación · Estilo Apple ======== */
#modal-nuevo-post {
  background: rgba(0, 0, 0, .35);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  animation: modalFadeIn .22s ease both;
}

@keyframes modalFadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

#modal-nuevo-post .modal-contenido {
  --sheet-radius: 22px;
  --ios-blue: #007AFF;
  --ios-gray: #F2F2F7;
  --ios-sep: rgba(0, 0, 0, .08);
  width: 92%;
  max-width: 520px;
  border-radius: var(--sheet-radius);
  padding: 18px 16px 14px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .18);
  position: relative;
  animation: sheetUp .24s cubic-bezier(.22, .9, .24, 1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
}

@keyframes sheetUp {
  from {
    transform: translateY(28px);
    opacity: 0
  }

  to {
    transform: translateY(0);
    opacity: 1
  }
}

/* “Grabber” superior */
#modal-nuevo-post .modal-contenido::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  width: 36px;
  height: 4px;
  background: #d1d1d6;
  border-radius: 999px;
  transform: translateX(-50%);
}

/* Cerrar */
#modal-nuevo-post .close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--ios-gray);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  line-height: 0;
  cursor: pointer;
  transition: background .15s ease, transform .08s ease;
}

#modal-nuevo-post .close-btn:active {
  transform: scale(.96);
}

/* Título */
#modal-nuevo-post h3 {
  margin: 10px 0 8px;
  text-align: center;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: .2px;
  color: #111;
}

/* Campos “Cupertino” */
#modal-nuevo-post input,
#modal-nuevo-post textarea,
#modal-nuevo-post select {
  width: 100%;
  appearance: none;
  border: 0;
  background: var(--ios-gray);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 16px;
  color: #111;
  margin-top: 10px;
  transition: box-shadow .18s ease, background .18s ease;
}

#modal-nuevo-post textarea {
  min-height: 120px;
  resize: vertical;
}

#modal-nuevo-post input::placeholder,
#modal-nuevo-post textarea::placeholder {
  color: #8e8e93;
}

#modal-nuevo-post input:focus,
#modal-nuevo-post textarea:focus,
#modal-nuevo-post select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, .22);
  background: #fff;
}

/* Select con flecha iOS */
#modal-nuevo-post select {
  background-image:
    linear-gradient(45deg, #8e8e93 50%, transparent 50%),
    linear-gradient(135deg, #8e8e93 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

/* Separador fino */
#modal-nuevo-post .sep {
  height: 1px;
  background: var(--ios-sep);
  margin: 14px 0 6px;
}

/* Acciones (Primario Azul Apple + Secundario Fantasma) */
#modal-nuevo-post .actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

#modal-nuevo-post .actions .btn {
  appearance: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .06s ease, box-shadow .18s ease, opacity .2s ease;
  border: 1px solid transparent;
}

#modal-nuevo-post .actions .btn:active {
  transform: translateY(1px);
}

#modal-nuevo-post .actions .btn-primary {
  background: var(--ios-blue);
  color: #fff;
  border-color: var(--ios-blue);
  box-shadow: 0 6px 14px rgba(0, 122, 255, .22);
}

#modal-nuevo-post .actions .btn-primary:hover {
  filter: brightness(.97);
}

#modal-nuevo-post .actions .btn-ghost {
  background: #fff;
  color: #111;
  border-color: #e5e5ea;
}

#modal-nuevo-post .actions .btn-ghost:hover {
  background: #f8f8f8;
}

/* Modo oscuro automático */
@media (prefers-color-scheme: dark) {
  #modal-nuevo-post {
    background: rgba(0, 0, 0, .55);
  }

  #modal-nuevo-post .modal-contenido {
    background: #1c1c1e;
    color: #f5f5f7;
  }

  #modal-nuevo-post .modal-contenido::before {
    background: #3a3a3c;
  }

  #modal-nuevo-post .close-btn {
    background: #2c2c2e;
    color: #f5f5f7;
  }

  #modal-nuevo-post input,
  #modal-nuevo-post textarea,
  #modal-nuevo-post select {
    background: #2c2c2e;
    color: #f5f5f7;
  }

  #modal-nuevo-post .actions .btn-ghost {
    background: #1c1c1e;
    color: #f5f5f7;
    border-color: #3a3a3c;
  }

  #modal-nuevo-post .actions .btn-ghost:hover {
    background: #2c2c2e;
  }
}


/* ===== PERFIL PÚBLICO (Modal Apple) ===== */
.pp-modal.oculto {
  display: none;
}

.pp-modal {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, .45);
  backdrop-filter: blur(18px) saturate(1.4);
  display: grid;
  place-items: center;
  z-index: 999;
  animation: pp-fade .25s ease;
}

@keyframes pp-fade {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

.pp-card {
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, .08);
  border: 1px solid #ececec;
  padding: 22px 20px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  transform: translateY(8px);
  animation: pp-up .28s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes pp-up {
  from {
    transform: translateY(16px);
    opacity: .7
  }

  to {
    transform: translateY(0);
    opacity: 1
  }
}

.pp-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #f7f7f8;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: filter .2s;
}

.pp-close:hover {
  filter: brightness(.96);
}

.pp-hero {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 6px 6px 12px;
}

.pp-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(145deg, #e9e9ea, #ffffff);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 28px;
  color: #111;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}

.pp-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pp-id {
  min-width: 0;
}

.pp-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.2px;
  color: #111;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pp-desc {
  margin: .25rem 0 0;
  color: #444;
  line-height: 1.35;
}

.pp-privacy {
  margin: .35rem 0 0;
  font-size: 14px;
  color: #6b7280;
}

.pp-tabs {
  display: flex;
  gap: 6px;
  margin: 14px 6px 6px;
  border-bottom: 1px solid #eee;
}

.pp-tab {
  appearance: none;
  background: none;
  border: none;
  padding: 10px 12px;
  border-bottom: 2px solid transparent;
  font-weight: 700;
  color: #999;
  cursor: pointer;
}

.pp-tab:hover {
  color: #111;
}

.pp-tab.is-active {
  color: #111;
  border-color: #111;
}

.pp-section {
  padding: 8px 6px 2px;
}

.pp-section.oculto {
  display: none;
}

.pp-list {
  display: grid;
  gap: 10px;
}

.pp-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.pp-card-item {
  border: 1px solid #ececec;
  border-radius: 16px;
  padding: 12px 14px;
  background: #fff;
  transition: box-shadow .2s, transform .05s;
}

.pp-card-item:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, .06);
  transform: translateY(-1px);
}

.pp-card-item .meta {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

.pp-card-item .title {
  font-weight: 800;
  font-size: 15px;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  font-size: 12px;
  margin-left: 6px;
}

.pp-progress {
  margin-top: 8px;
}

.pp-progress .top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
}

.pp-bar {
  height: 8px;
  background: #f3f4f6;
  border-radius: 999px;
  overflow: hidden;
}

.pp-fill {
  height: 100%;
  width: 0;
  background: #111;
  opacity: .15;
}

/* Publicaciones del perfil renderizadas como el feed */
.pp-as-feed .post {
  margin: 0 0 12px 0;
  /* separación vertical suave dentro del modal */
  border-radius: 16px;
  /* bordes suaves como iOS */
  border: 1px solid #ececec;
}

/* Evita que el ancho rebose en modales estrechos */
.pp-as-feed .post-row {
  max-width: 100%;
}

/* Si tu feed tenía sombras/hover, puedes suavizarlas aquí si lo deseas */
.pp-as-feed .post:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, .06);
  transform: translateY(-1px);
  transition: .15s ease;
}

/* Aplica estilos del feed también dentro del modal del perfil */
.pp-as-feed .post {
  all: unset;
  display: block;
}

.pp-as-feed .post {
  /* copia lo esencial del estilo de #feed .post si estaba scropeado */
  border: 1px solid #ececec;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
}

/* Si tenías reglas como #feed .post-row, #feed .post-head, etc., añade sus equivalentes: */
.pp-as-feed .post-row {
  /* lo que tuviera #feed .post-row */
}

.pp-as-feed .post-head {
  /* lo que tuviera #feed .post-head */
}

.pp-as-feed .post-title {
  /* lo que tuviera #feed .post-title */
}

.pp-as-feed .post-snippet {
  /* ... */
}

.pp-as-feed .counters {
  /* ... */
}

.pp-as-feed .counter {
  /* ... */
}

/* …añade aquí las que en tu CSS original empiecen por #feed … */

/* ===== Modal estilo Apple ===== */
.apple-modal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  backdrop-filter: blur(10px);
}

.apple-modal.oculto {
  display: none;
}

.apple-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.3s ease;
}

.apple-modal__card {
  position: relative;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: saturate(180%) blur(20px);
  border-radius: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  width: min(480px, 90vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.4s ease;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

@media (prefers-color-scheme: dark) {
  .apple-modal__card {
    background: rgba(25, 25, 25, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }
}

.apple-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 600;
  color: #111;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
}

.apple-modal__header h3 {
  font-size: 18px;
  margin: 0;
  text-align: left;
}

.apple-modal__close {
  appearance: none;
  border: none;
  background: none;
  font-size: 24px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.apple-modal__close:hover {
  opacity: 0.9;
}

.apple-modal__body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.apple-modal__footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
}

.apple-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
}

.apple-input:focus {
  border-color: #007aff;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

.apple-btn {
  background: #007aff;
  color: #fff;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.apple-btn:hover {
  background: #0062cc;
}

.comment {
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(6px);
}

.comment .c-name {
  font-weight: 600;
  color: #111;
}

.comment .c-text {
  margin-top: 4px;
  font-size: 14px;
  color: #333;
}

/* Animaciones */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ===== Animación Apple para la hoja de detalle ===== */

#sheet-post {
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(.21, 1.02, .73, 1);
}

#sheet-post.open {
  transform: translateY(0%);
}

#sheet-post.closing {
  transform: translateY(100%);
}

/* Topbar estilo iOS (blur, semitransparente) */
#sheet-post .sheet-topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: calc(8px + env(safe-area-inset-top)) 12px 10px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(1.8) blur(18px);
  -webkit-backdrop-filter: saturate(1.8) blur(18px);
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

#sheet-post .back-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 22px;
}

#sheet-post .back-btn:active {
  transform: scale(.94);
}

/* =========================================================
   APPLE FULLSCREEN POST DETAIL — iOS STYLE
   Para <section id="sheet-post" class="sheet">
   ========================================================= */

/* --- Animación tipo iOS (slide-up) --- */
#sheet-post {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;

  background: #ffffff;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(.21, 1.02, .73, 1);
}

#sheet-post.open {
  transform: translateY(0%);
}

#sheet-post.closing {
  transform: translateY(100%);
}

#sheet-post.oculto {
  display: none !important;
}

/* --- Topbar estilo Apple (blur + translucidez) --- */
#sheet-post .sheet-topbar {
  position: sticky;
  top: 0;
  z-index: 10;

  height: calc(46px + env(safe-area-inset-top));
  padding: calc(6px + env(safe-area-inset-top)) 12px 8px;

  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(1.8) blur(18px);
  -webkit-backdrop-filter: saturate(1.8) blur(18px);

  display: flex;
  align-items: center;
  justify-content: flex-start;

  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* --- Botón atrás estilo iOS --- */
#sheet-post .sheet-topbar .back-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  display: grid;
  place-items: center;
  font-size: 23px;
  cursor: pointer;
  transition: transform .12s;
}

#sheet-post .sheet-topbar .back-btn:active {
  transform: scale(.92);
}

/* --- Contenido del detalle con scroll suave iOS --- */
#sheet-post .post-detail {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  padding: 18px 18px 120px;
  font-size: 16px;
  color: #222;
}

/* Sombrado superior para efecto "profundidad Apple" */
#sheet-post .post-detail::before {
  content: "";
  position: sticky;
  top: 0;
  height: 22px;
  margin-top: -22px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .08), transparent);
  pointer-events: none;
  z-index: 5;
}

/* --- Sección del autor / avatar más limpia y Apple --- */
#sheet-post .detail-author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 15px;
  color: #6b6b6b;
}

#sheet-post .detail-author img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}

/* --- Título --- */
#sheet-post .detail-title {
  font-size: 20px;
  font-weight: 700;
  margin: 6px 0 16px;
  line-height: 1.3;
  color: #111;
}

/* --- Texto --- */
#sheet-post .detail-body {
  font-size: 16px;
  line-height: 1.55;
  color: #2c2c2c;
  margin-bottom: 22px;
  text-align: justify;
}

/* --- Comentarios --- */
#sheet-post .comments {
  margin-top: 14px;
}

#sheet-post .comment {
  padding: 16px 0;
  display: flex;
  gap: 12px;
}

#sheet-post .comment .c-name {
  font-size: 15px;
  font-weight: 700;
  color: #111;
}

#sheet-post .comment .c-text {
  font-size: 15px;
  color: #333;
  line-height: 1.5;
}

/* --- Composer fijo abajo (input + enviar) --- */
#sheet-post .composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;

  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(0, 0, 0, 0.06);

  display: grid;
  grid-template-columns: 1fr 50px;
  gap: 10px;
}

#sheet-post .composer input {
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: #f4f4f6;
  padding: 12px 16px;
  font-size: 15px;
}

#sheet-post .composer button {
  background: #111;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s;
}

#sheet-post .composer button:active {
  transform: scale(.95);
}

/* =========================================================
   APPLE STYLE · DETALLE DE PUBLICACIÓN (#sheet-post)
   ========================================================= */

#sheet-post {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;

  /* Fondo tipo iOS (gris suave) */
  background: #f5f5f7;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
    system-ui, sans-serif;
}

/* Topbar tipo iOS: blur + separación notch */
#sheet-post .sheet-topbar {
  position: sticky;
  top: 0;
  z-index: 10;

  display: flex;
  align-items: center;
  justify-content: flex-start;

  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(1.8) blur(18px);
  -webkit-backdrop-filter: saturate(1.8) blur(18px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* Botón atrás circular, estilo iOS */
#sheet-post .sheet-topbar .back-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  display: grid;
  place-items: center;
  font-size: 22px;
  color: #111;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease;
}

#sheet-post .sheet-topbar .back-btn:active {
  transform: scale(.93);
  background: rgba(0, 0, 0, 0.1);
}

/* Área de contenido: sheet blanca flotando */
#sheet-post #post-detail {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  /* “Tarjeta” blanca dentro del fondo gris */
  background: #ffffff;
  padding: 20px 18px 110px;

  border-radius: 24px 24px 0 0;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

/* Píldora categoría más marcada */
#sheet-post .detail-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
  margin-top: 5px;
}

/* Autor y meta */
#sheet-post .detail-author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  font-size: 14px;
  color: #6b7280;
}

#sheet-post .detail-author .name {
  font-weight: 700;
  color: #111;
}

/* Título grande estilo Apple News */
#sheet-post .detail-title {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  margin: 4px 0 18px;
  color: #111;
}

/* Cuerpo del post */
#sheet-post .detail-body {
  font-size: 16px;
  line-height: 1.55;
  color: #1f2933;
  margin-bottom: 18px;
  text-align: justify;
}

/* Comentarios */
#sheet-post .comments {
  margin-top: 10px;
  padding-top: 10px;
}

#sheet-post .comment {
  display: flex;
  gap: 10px;
  padding: 12px 0;
}

#sheet-post .comment .c-name {
  font-weight: 600;
  color: #111;
}

#sheet-post .comment .c-text {
  font-size: 15px;
  color: #374151;
}

/* Composer pegado al borde inferior tipo iMessage */
#sheet-post .composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;

  display: grid;
  grid-template-columns: 1fr 52px;
  gap: 10px;

  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: transparent;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  margin-bottom: 80px;
}

#sheet-post .composer input {
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #ffffff;
  padding: 10px 14px;
  font-size: 15px;
}

#sheet-post .composer button {
  border: none;
  border-radius: 14px;
  background: #111111;
  color: #ffffff;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .16s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

#sheet-post .composer button:active {
  transform: scale(.95);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* En pantallas grandes, que se siga viendo “sheet” centrada */
@media (min-width: 900px) {
  #sheet-post #post-detail {
    margin-top: 18px;
    padding: 24px 26px 120px;
  }
}

/* ========== PERFIL PÚBLICO — MODAL APPLE STYLE ========== */

.pp-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: none;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.pp-modal:not(.oculto) {
  display: flex;
}

/* Tarjeta principal: sheet iOS */
.pp-card {
  position: relative;
  width: 100%;
  max-height: calc(100vh - 24px);
  margin: 0 auto;
  padding: 24px 18px 18px;
  border-radius: 26px 26px 0 0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.24),
    0 0 0 0.5px rgba(0, 0, 0, 0.04);
  /* Estado inicial: fuera de pantalla por abajo */
  transform: translateY(100%);
  opacity: 0;
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  /* La animación se dispara al mostrarse el modal */
}

/* Cuando el modal está visible, animamos la tarjeta hacia arriba */
.pp-modal:not(.oculto) .pp-card {
  animation: pp-slide-up 260ms cubic-bezier(0.24, 0.9, 0.24, 1) forwards;
}

/* Animación de entrada tipo iOS sheet desde abajo */
@keyframes pp-slide-up {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0%);
    opacity: 1;
  }
}

/* Handle superior tipo iOS */
.pp-card::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
}

/* Botón cerrar (esquina) */
.pp-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  background: rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: background 0.16s ease, transform 0.12s ease;
}

.pp-close:hover {
  background: rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

/* HERO: avatar + nombre */
.pp-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  margin-bottom: 12px;
}

/* Marco del avatar (con halo suave) */
.pp-avatar {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border-radius: 999px;
  padding: 2px;
  background: radial-gradient(circle at 10% 0%, #e5e7eb 0, #cbd5f5 40%, #fef3c7 100%);
  display: grid;
  place-items: center;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.8),
    0 12px 25px rgba(0, 0, 0, 0.25);
}

.pp-avatar img,
.pp-avatar .avatar-inicial {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: white;
  color: black;
  font-weight: 700;
  font-size: 28px;
  display: grid;
  place-items: center;
  object-fit: cover;
}

/* Texto de identidad */
.pp-id {
  min-width: 0;
}

.pp-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 2px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
}

#pp-tick svg {
  vertical-align: middle;
}

.pp-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: #4b5563;
}

.pp-privacy {
  margin: 6px 0 0;
  font-size: 12px;
  color: #6b7280;
}

/* Tabs tipo “segmented control” */
.pp-tabs {
  margin-top: 14px;
  margin-bottom: 10px;
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: #f3f4f6;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.22);
}

.pp-tab {
  position: relative;
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.12s ease;
}

.pp-tab.is-active {
  background: #111827;
  color: #f9fafb;
  /*box-shadow:
    0 6px 14px rgba(15, 23, 42, 0.35),
    0 0 0 1px rgba(15, 23, 42, 0.6);*/
}

.pp-tab:active {
  transform: scale(0.97);
}

/* Contenido */
.pp-section {
  margin-top: 8px;
  padding-bottom: 8px;
  max-height: calc(100vh - 170px);
  overflow: auto;
}

.pp-list,
.pp-grid {
  display: grid;
  gap: 10px;
}

/* Cards de publicaciones/cartera dentro del modal */
.pp-card-item {
  border-radius: 18px;
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.03);
  font-size: 13px;
  cursor: default;
}

.pp-card-item .title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.pp-card-item .meta {
  margin-top: 2px;
  font-size: 12px;
  color: #6b7280;
}

/* Mini badge para divisa o estado */
.pp-card-item .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 0 8px;
  height: 20px;
  border-radius: 999px;
  background: #0f172a;
  color: #f9fafb;
  font-size: 11px;
  font-weight: 600;
}

/* Progreso de plazo en cartera */
.pp-progress {
  margin-top: 8px;
}

.pp-progress .top {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #6b7280;
}

.pp-bar {
  margin-top: 4px;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.pp-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

/* Feed “embebido” dentro del perfil (reutiliza estilos de .post) */
.pp-as-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pp-as-feed .post {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: #fff;
}

/* Estado vacío / textos secundarios */
.pp-section .muted,
.pp-card-item.muted {
  color: #9ca3af;
  font-size: 12px;
}

/* Responsive desktop: tarjeta centrada, no tipo hoja inferior */
@media (min-width: 768px) {
  .pp-modal {
    align-items: center;
  }

  .pp-card {
    border-radius: 28px;
    max-width: 720px;
    max-height: 88vh;
    padding: 26px 24px 20px;
  }

  .pp-section {
    max-height: calc(88vh - 170px);
  }
}

/* Grid para cartera en pantallas algo más grandes */
@media (min-width: 520px) {
  .pp-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Animación de entrada tipo iOS sheet */
@keyframes pp-slide-up {
  from {
    transform: translateY(100%);
    opacity: 0.9;
  }

  to {
    transform: translateY(0%);
    opacity: 1;
  }
}

/* Modo oscuro (opcional, por si navegan con dark mode del SO) */
@media (prefers-color-scheme: dark) {
  .pp-card {
    background: rgba(17, 24, 39, 0.92);
    color: #e5e7eb;
    box-shadow:
      0 18px 40px rgba(0, 0, 0, 0.7),
      0 0 0 0.5px rgba(148, 163, 184, 0.6);
  }

  .pp-card::before {
    background: rgba(148, 163, 184, 0.6);
  }

  .pp-close {
    background: rgba(15, 23, 42, 0.8);
    color: #e5e7eb;
  }

  .pp-close:hover {
    background: rgba(15, 23, 42, 0.95);
  }

  .pp-title {
    color: #f9fafb;
  }

  .pp-desc,
  .pp-privacy {
    color: #9ca3af;
  }

  .pp-tabs {
    background: rgba(15, 23, 42, 0.9);
    box-shadow: inset 0 0 0 1px rgba(31, 41, 55, 0.9);
  }

  .pp-tab {
    color: #9ca3af;
  }

  .pp-tab.is-active {
    background: #f9fafb;
    color: #020617;
    box-shadow:
      0 6px 16px rgba(0, 0, 0, 0.6),
      0 0 0 1px rgba(15, 23, 42, 0.5);
  }

  .pp-card-item {
    background: #020617;
    border-color: rgba(55, 65, 81, 0.9);
  }

  .pp-card-item .title {
    color: #f9fafb;
  }

  .pp-card-item .meta {
    color: #9ca3af;
  }

  .pp-bar {
    background: #1f2937;
  }
}

/* ==== FIX AVATARES EN COMENTARIOS (detalle y modal) ==== */

/* Contenedor circular */
.comment .avatar,
#sheet-post .comment .avatar,
.avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  /* 💡 recorta la imagen dentro del círculo */
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* La imagen ocupa todo el contenedor y se recorta en círculo */
.comment .avatar img,
#sheet-post .comment .avatar img,
.avatar-img img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  /* 💡 ahora sí, en el <img> */
  display: block;
}

/* ===== Splash blanco al cargar Comunidad ===== */
#comunidad-splash {
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 1000;
  /* por encima de modales, sheets, etc. */
  pointer-events: auto;
  opacity: 1;
  transition: opacity 0.3s ease;
}

#comunidad-splash.oculto {
  opacity: 0;
  pointer-events: none;
}
























/* =========================================================
   BLOOMBERG MOBILE (COHERENTE) — Tendencias & Recientes
   Mantiene estructura de posts. Solo cambia look&feel.
   ========================================================= */
@media (max-width: 640px) {

  /* --- Base del área feed --- */
  #feed {
    max-width: 760px;
    margin: 0 auto;
    padding: 8px 0 110px;
  }

  /* --- Tabs Tendencias / Recientes (sobrias, sin “pills”) --- */
  .feed-tabs {
    position: sticky;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: saturate(140%) blur(10px);
    padding: 10px 14px 8px;
    display: flex;
    gap: 16px;
    align-items: center;
  }

  .feed-tabs .tab {
    font-size: 12px;
    letter-spacing: .10em;
    text-transform: uppercase;
    font-weight: 800;
    color: rgba(2, 6, 23, .55);
    padding: 6px 0;
    border-radius: 0;
  }

  .feed-tabs .tab.is-active {
    color: rgba(2, 6, 23, .92);
    position: relative;
  }

  .feed-tabs .tab.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -9px;
    height: 2px;
    background: rgba(2, 6, 23, .92);
  }

  /* --- Post = bloque editorial, sin tarjetas ni sombras --- */
  .post {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 14px 14px 12px;
    margin: 0;
  }

  .post-row {
    display: block;
    /* evita layouts “raros” si tenías grid */
  }

  /* --- Head: sección + autor (todo alineado) --- */
  .post-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 0 0 8px 0;
  }

  /* “Sección” como kicker simple, sin barra ni cápsula */
  .pill {
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;

    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    font-weight: 900;
    color: rgba(2, 6, 23, .70) !important;
    line-height: 1;
  }

  .meta-author {
    font-size: 12px;
    color: rgba(2, 6, 23, .55);
  }

  .link-author {
    color: rgba(2, 6, 23, .72);
    text-decoration: none;
    font-weight: 700;
  }

  /* --- Título: serif editorial, pero sin exagerar --- */
  .post-title {
    font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
    letter-spacing: -.01em;
    font-size: 18px;
    line-height: 1.14;
    margin: 0 0 8px 0;
    color: rgba(2, 6, 23, .96);
  }

  /* --- Cuerpo / snippet: system, limpio --- */
  .post-snippet {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(2, 6, 23, .78);
    margin: 0 0 12px 0;
  }

  /* --- Medios: consistentes, sin “lujo” --- */
  .post img,
  .post iframe,
  .post video {
    border-radius: 10px;
    overflow: hidden;
    display: block;
    width: 100%;
    box-shadow: none;
    border: 1px solid rgba(2, 6, 23, .10);
  }

  /* --- Footer: acciones estilo Bloomberg (texto + icono, sin píldoras) --- */
  .post-foot {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    padding-top: 10px;
    margin-top: 10px;
  }

  .counters {
    display: flex;
    gap: 16px;
    align-items: center;
  }

  .counter {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    padding: 0;
    border: 0;
    background: transparent;

    font-size: 12px;
    font-weight: 800;
    color: rgba(2, 6, 23, .58);
  }

  .counter.is-liked {
    color: rgba(2, 6, 23, .90);
  }

  .icon {
    width: 16px;
    height: 16px;
    opacity: .85;
  }
}

/* =========================
   Post layout con avatar (estilo X / Bloomberg)
   ========================= */
.post-row--with-avatar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.post-avatar-col {
  flex: 0 0 42px;
  width: 42px;
  padding-top: 2px;
  /* alinea con primera línea del head */
}

.post-avatar-col .avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #f3f4f6;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06);
}

.post-avatar-col .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-avatar-col .avatar-inicial span {
  font-weight: 800;
  font-size: 14px;
  color: #111;
}

/* la columna del contenido */
.post-main {
  flex: 1;
  min-width: 0;
}

/* el head queda más “limpio” y alineado */
.post-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.post-title {
  margin-top: 6px;
}

/* opcional: que el snippet respire como “post” */
.post-snippet {
  margin-top: 6px;
  color: #1f2937;
  line-height: 1.35;
}

/* ================================
   BLOOMBERG — Perfil Público (pp-modal)
   ================================ */
#modal-perfil.pp-modal {
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(140%) blur(10px);
}

#modal-perfil .pp-card {
  width: 100%;
  height: 100%;
  margin: 0 auto;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

#modal-perfil .pp-close {
  top: calc(10px + env(safe-area-inset-top));
  right: 12px;
  border: 1px solid rgba(2, 6, 23, .10);
  background: rgba(255, 255, 255, .90);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  font-weight: 900;
  z-index: 30;
}

/* Hero editorial */
#modal-perfil .pp-hero {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid rgba(2, 6, 23, .10);
  padding: calc(12px + env(safe-area-inset-top)) 14px 12px;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
}

#modal-perfil .pp-avatar {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  overflow: hidden;
  background: #f3f4f6;
  box-shadow: 0 0 0 1px rgba(2, 6, 23, .08);
  display: grid;
  place-items: center;
  font-weight: 900;
}

#modal-perfil .pp-title {
  margin: 0;
  font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
  font-weight: 900;
  letter-spacing: -.01em;
  line-height: 1.08;
  font-size: 22px;
  color: #0b1220;
}

#modal-perfil .pp-desc {
  margin: 6px 0 0;
  font-size: 13px;
  color: rgba(2, 6, 23, .62);
}

/* Tabs Bloomberg */
#modal-perfil .pp-tabs {
  position: sticky;
  top: calc(88px + env(safe-area-inset-top));
  /* debajo del hero */
  z-index: 4;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid rgba(2, 6, 23, .10);
  padding: 8px 14px;
  display: flex;
  gap: 18px;
}

#modal-perfil .pp-tab {
  border: 0;
  background: transparent;
  padding: 8px 0;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(2, 6, 23, .55);
}

#modal-perfil .pp-tab.is-active {
  color: rgba(2, 6, 23, .92);
  position: relative;
}

#modal-perfil .pp-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -9px;
  height: 2px;
  background: rgba(2, 6, 23, .92);
}

/* Contenido */
#modal-perfil .pp-section {
  padding: 12px 14px 120px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Lista (posts/cartera) con separadores finos */
#modal-perfil .pp-list {
  display: grid;
  gap: 0;
}

#modal-perfil .pp-list .post {
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(2, 6, 23, .10);
  border-radius: 0;
  box-shadow: none;
  padding: 14px 0;
  margin: 0;
}

/* Si tus posts en perfil usan el layout con avatar, se verá perfecto */
#modal-perfil .pp-list .post-row--with-avatar {
  padding: 0 0;
}

/* Si en el perfil renderizas “cards” de cartera */
#modal-perfil .pp-grid .cartera-card,
#modal-perfil .pp-grid .pp-card-item {
  border: 1px solid rgba(2, 6, 23, .10);
  border-radius: 16px;
  background: #fff;
  box-shadow: none;
}

/* =========================================================
   BLOOMBERG — POST DETALLE (sheet)
   ========================================================= */
#sheet-post {
  background: #fff;
}

#sheet-post .sheet-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid rgba(2, 6, 23, .10);
}

/* Botón back minimal */
#sheet-post .back-btn {
  border: 0;
  background: transparent;
  color: #0b1220;
  font-weight: 900;
  font-size: 18px;
  padding: 12px 14px;
}

#post-detail {
  padding: 14px 14px 120px;
}

.detail-wrap {}

/* Kicker Bloomberg (no pill) */
.detail-kicker {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(2, 6, 23, .70);
  margin: 2px 0 12px;
}

/* Meta row avatar + autor + fecha */
.detail-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.detail-meta .avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  overflow: hidden;
  background: #f3f4f6;
  box-shadow: 0 0 0 1px rgba(2, 6, 23, .08);
  display: grid;
  place-items: center;
}

.detail-meta .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-metaText {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.detail-author {
  font-size: 14px;
  font-weight: 850;
  color: rgba(2, 6, 23, .92);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.detail-date {
  font-size: 12px;
  color: rgba(2, 6, 23, .55);
  font-weight: 600;
}

/* Título: manda de verdad */
.detail-title {
  font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
  font-weight: 950;
  letter-spacing: -.01em;
  line-height: 1.1;
  margin: 12px 0 12px;
  font-size: clamp(24px, 2.3vw + 14px, 38px);
  color: #0b1220;
}

/* Texto: editorial y respirable */
.detail-body {
  font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
  font-size: 16px;
  line-height: 1.72;
  color: rgba(2, 6, 23, .84);
  margin: 0 0 14px;
}

.detail-body p {
  margin: 0 0 12px;
}

/* Encuestas */
.detail-poll {
  border-top: 1px solid rgba(2, 6, 23, .10);
  padding-top: 10px;
}

.detail-poll__opt {
  padding: 10px 0;
  border-bottom: 1px solid rgba(2, 6, 23, .08);
  font-size: 15px;
}

/* Vídeo/iframes: sin sombras ni “card vibe” */
#post-detail iframe,
#post-detail video {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(2, 6, 23, .10);
  box-shadow: none;
  overflow: hidden;
  margin: 10px 0 6px;
}

/* Acciones: texto editorial (no “app buttons”) */
.detail-actions {
  display: flex;
  gap: 18px;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid rgba(2, 6, 23, .10);
  margin-top: 14px;
}

.detail-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  color: rgba(2, 6, 23, .58);
}

.detail-action .icon {
  width: 16px;
  height: 16px;
  opacity: .7;
}

.detail-action.is-liked {
  color: rgba(2, 6, 23, .92);
}

/* Comentarios: Bloomberg = reglas finas */
.detail-comments {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(2, 6, 23, .10);
}

/* ======================================================
   PERFIL PÚBLICO — AJUSTES PARA MÓVILES PEQUEÑOS
   ====================================================== */
@media (max-width: 420px) {

  /* Modal general */
  .pp-card {
    padding: 18px 14px 14px;
    border-radius: 22px 22px 0 0;
  }

  /* Avatar */
  .pp-avatar {
    width: 56px;
    height: 56px;
  }

  .pp-avatar img,
  .pp-avatar .avatar-inicial {
    font-size: 20px;
  }

  /* Nombre */
  .pp-title {
    font-size: 16px;
    line-height: 1.2;
  }

  /* Bio */
  .pp-desc {
    font-size: 12.5px;
    line-height: 1.35;
  }

  /* Info privacidad */
  .pp-privacy {
    font-size: 12px;
  }

  /* Tabs */
  .pp-tabs {
    gap: 4px;
    margin-top: 10px;
  }

  .pp-tab {
    padding: 8px 6px;
    font-size: 13px;
  }

  /* Contenido */
  .pp-section {
    padding: 6px 2px;
  }

  /* Publicaciones dentro del perfil */
  .pp-as-feed .post {
    padding: 10px 12px;
  }

  .pp-as-feed .post-title {
    font-size: 14.5px;
  }

  .pp-as-feed .post-snippet {
    font-size: 13.5px;
  }

  /* Contadores (likes, comentarios) */
  .pp-as-feed .counter {
    font-size: 13px;
    gap: 4px;
  }

  .pp-as-feed .icon {
    width: 15px;
    height: 15px;
  }

  /* Botón cerrar */
  .pp-close {
    width: 26px;
    height: 26px;
    font-size: 14px;
    top: 10px;
    right: 10px;
  }
}

@media (max-width: 340px) {
  .counters {
    display: flex;
    gap: 6px;
    align-items: center;
  }
}

/* ===== RI Avatar Menu Skeleton (cubre al 100%) ===== */
#avatar-menu{
  position: relative; /* clave para el overlay */
  overflow: hidden;
}

/* El overlay skeleton */
#avatar-menu .ri-avatar-skel{
  position: absolute;
  inset: 0;
  z-index: 999;
  display: none;
  pointer-events: none;
  padding: 16px;
  background: inherit; /* mismo fondo que el menú */
}

/* Cuando loading: ocultamos TODO lo real (sin dejarlo "ver" detrás) */
#avatar-menu.ri-menu-loading .avatar-sheet-handle,
#avatar-menu.ri-menu-loading .avatar-header,
#avatar-menu.ri-menu-loading .avatar-menu-body{
  visibility: hidden !important;
}

/* Cuando loading: mostramos el skeleton */
#avatar-menu.ri-menu-loading .ri-avatar-skel{
  display: block;
}

/* Shimmer */
@keyframes riMenuShine{
  0%{ background-position: 200% 0; }
  100%{ background-position: -200% 0; }
}
#avatar-menu .ri-skel{
  border-radius: 14px;
  background: linear-gradient(90deg,#e6e8ec 25%,#f2f4f7 37%,#e6e8ec 63%);
  background-size: 400% 100%;
  animation: riMenuShine 1.1s ease-in-out infinite;
}
@media (prefers-color-scheme: dark){
  #avatar-menu .ri-skel{
    background: linear-gradient(90deg,#1f232b 25%,#2a2f38 37%,#1f232b 63%);
    background-size: 400% 100%;
  }
}

/* Layout skeleton dentro del menú */
#avatar-menu .ri-avatar-skel .sk-row{ height: 12px; border-radius: 999px; }
#avatar-menu .ri-avatar-skel .sk-row.r1{ width: 60%; }
#avatar-menu .ri-avatar-skel .sk-row.r2{ width: 85%; margin-top: 10px; }
#avatar-menu .ri-avatar-skel .sk-btn{ height: 42px; border-radius: 12px; margin-top: 12px; }
#avatar-menu .ri-avatar-skel .sk-head{
  display:flex; gap:12px; align-items:center; margin-bottom: 14px;
}
#avatar-menu .ri-avatar-skel .sk-avatar{
  width: 44px; height: 44px; border-radius: 999px;
}

/* =========================
   Avatar Menu Skeleton (al abrir) — IGUAL QUE INDEX
   ========================= */

@keyframes ri-ava-skel-shine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.avatar-menu.is-loading {
  pointer-events: none; /* bloquea clicks mientras “carga” */
}

.avatar-menu-skeleton {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  padding: 10px 16px 18px;
  background: transparent;
}

.avatar-menu.is-loading .avatar-menu-skeleton {
  display: block;
}

/* bloque shimmer base */
.avatar-menu-skeleton .sk {
  background: linear-gradient(90deg, rgba(0,0,0,0.08), rgba(0,0,0,0.04), rgba(0,0,0,0.08));
  background-size: 220% 100%;
  animation: ri-ava-skel-shine 1.1s linear infinite;
  border-radius: 14px;
}

@media (prefers-color-scheme: dark) {
  .avatar-menu-skeleton .sk {
    background: linear-gradient(90deg, rgba(255,255,255,0.12), rgba(255,255,255,0.06), rgba(255,255,255,0.12));
  }
}

/* layout skeleton dentro del sheet */
.avatar-menu-skeleton .sk-handle {
  width: 44px; height: 5px; border-radius: 999px;
  margin: 4px auto 12px;
}

.avatar-menu-skeleton .sk-head {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 2px 0 14px;
}

.avatar-menu-skeleton .sk-avatar {
  width: 72px; height: 72px; border-radius: 999px;
}

.avatar-menu-skeleton .sk-name {
  width: 160px; height: 14px; border-radius: 999px;
}

.avatar-menu-skeleton .sk-items {
  display: grid;
  gap: 8px;
  padding-top: 6px;
}

.avatar-menu-skeleton .sk-item {
  height: 44px;
  border-radius: 13px;
}

/* 1) Que el overlay tape de verdad */
.avatar-menu-skeleton{
  background: var(--panel, rgba(255,255,255,0.98));
  backdrop-filter: blur(12px);
}

@media (prefers-color-scheme: dark){
  .avatar-menu-skeleton{
    background: rgba(20,20,20,0.92);
  }
}

/* 2) Ocultar TODO el contenido del menú mientras carga, excepto el skeleton */
.avatar-menu.is-loading > :not(.avatar-menu-skeleton){
  opacity: 0 !important;
  visibility: hidden !important;
}

/* (opcional) evita “saltos” al quitar el loading */
.avatar-menu > :not(.avatar-menu-skeleton){
  transition: opacity .12s ease, visibility .12s ease;
}