html, body { touch-action: manipulation; }
html { scroll-padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
/* PublycApp web — tema oscuro aprobado (navy, verde vivo, dorado) */
:root {
  --bg: #0D1623;
  --card: #1B293C;
  --card-soft: #142233;
  --green: #2BE0B0;
  --green-soft: #77E8CD;
  --green-deep: #213B43;
  --teal: #38C9E3;
  --ink: #F4F7FC;
  --muted: #B6C6D7;
  --gold: #FFD166;
  --ok: #34D399;
  --red-soft: #492932;
  --button-text: #052C23;
  --radius: 24px;
  --radius-sm: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
  min-height: 100vh;
}
.app { max-width: 720px; margin: 0 auto; padding: 0 14px calc(128px + env(safe-area-inset-bottom)); min-height: calc(100vh + 128px + env(safe-area-inset-bottom)); min-height: calc(100dvh + 128px + env(safe-area-inset-bottom)); }
a { color: var(--green); text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; }
img { max-width: 100%; display: block; }

/* Encabezado */
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 0 4px; }
.topbar .logo { width: 42px; height: 42px; border-radius: 11px; flex: none; }
.topbar h1 { font-size: 22px; letter-spacing: 1px; color: var(--green); }
.topbar .tagline { color: var(--muted); font-size: 13px; }
.topbar .bell { margin-left: auto; width: 40px; height: 40px; border-radius: 50%; background: transparent; display: grid; place-items: center; position: relative; }
.topbar .bell svg { width: 26px; height: 26px; stroke: var(--green); }
.topbar .bell .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--gold); color: var(--button-text); font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }

.pilot-row { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 10px; }
.chip { display: inline-block; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.chip-gold { color: var(--gold); background: rgba(255, 209, 102, .08); border: 1px solid rgba(255, 209, 102, .35); }
.link-btn { background: none; color: var(--green); font-weight: 600; padding: 6px 0; }
.link-btn:active { opacity: .7; }

/* Buscador */
.search { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 999px; padding: 9px 14px; position: sticky; top: 6px; z-index: 5; }
.search input { border: 0; outline: 0; flex: 1; font-size: 16px; color: #333; background: transparent; }
.search svg { width: 20px; height: 20px; stroke: #8aa; flex: none; }

/* Secciones */
.section { margin-top: 16px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.section h2 { font-size: 19px; }
.section .more { color: var(--green); font-weight: 600; font-size: 15px; }
.note { color: var(--muted); font-size: 12.5px; margin-top: 8px; }

/* Categorías */
.cats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.cat { background: var(--card); border-radius: var(--radius-sm); padding: 11px 6px; text-align: center; color: var(--ink); font-weight: 600; font-size: 13.5px; position: relative; border: 2px solid transparent; }
.cat.on { border-color: var(--green); background: var(--green-deep); }
.cat .tick { position: absolute; top: 4px; right: 6px; width: 18px; height: 18px; border-radius: 50%; background: var(--green); color: #0D1623; font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.cat .ic { width: 24px; height: 24px; margin: 0 auto 5px; }
.cat .ic svg { width: 100%; height: 100%; stroke: var(--green); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cat:active { background: var(--green-deep); }

/* Tarjetas y publicaciones */
.card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pub { background: var(--card); border-radius: var(--radius); overflow: hidden; display: block; color: var(--ink); text-align: left; padding: 0; }
.pub .ph { aspect-ratio: 4/3; background: var(--green-deep); display: grid; place-items: center; overflow: hidden; }
.pub .ph img { width: 100%; height: 100%; object-fit: cover; }
.pub .ph span { color: var(--muted); font-size: 14px; }
.pub .body { padding: 10px 12px 12px; }
.pub .t { font-weight: 700; font-size: 13px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pub .m { color: var(--muted); font-size: 11.5px; margin-top: 3px; line-height: 1.3; }
.pub .price { color: var(--green); font-weight: 700; }
.pub .badges { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
/* Tarjeta compacta de «Mis publicaciones» (pedido usuario 24nov): miniatura
   pequeña a la izquierda y datos a la derecha; conserva corazón e insignias. */
.pubc { display: flex; gap: 10px; align-items: center; background: var(--card); border-radius: var(--radius); overflow: hidden; color: var(--ink); text-align: left; padding: 8px; }
.pubc .ph { position: relative; width: 72px; height: 72px; flex: 0 0 72px; border-radius: 12px; background: var(--green-deep); display: grid; place-items: center; overflow: hidden; }
.pubc .ph img { width: 100%; height: 100%; object-fit: cover; }
.pubc .ph span { color: var(--muted); font-size: 12px; }
.pubc .body { flex: 1; min-width: 0; padding: 2px 0; }
.pubc .t { font-weight: 700; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pubc .m { color: var(--muted); font-size: 11.5px; margin-top: 3px; line-height: 1.3; }
.pubc .fav-heart { width: 28px; height: 28px; top: 4px; right: 4px; padding: 5px; }
.pubc .fav-heart svg { width: 16px; height: 16px; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--card-soft); color: var(--muted); }
.badge-gold { color: var(--gold); border: 1px solid rgba(255,209,102,.4); background: transparent; }
.badge-out { color: #F0A3A3; background: var(--red-soft); }

.carousel { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.carousel .pub { min-width: 168px; scroll-snap-align: start; border: 1.5px solid rgba(255,209,102,.55); }

/* Botones */
.btn { display: block; width: 100%; padding: 15px; border-radius: 999px; font-weight: 700; font-size: 16px; text-align: center; }
.btn-green { background: var(--green); color: var(--button-text); }
.btn-green:active { background: var(--green-soft); }
.btn-ghost { background: var(--card); color: var(--ink); border: 1.5px solid rgba(255,255,255,.22); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-row .btn { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; justify-content: center; padding: 12px 10px; font-size: 15px; }

/* Formularios */
.tabs { display: flex; background: var(--card); border-radius: 999px; padding: 6px; gap: 4px; margin: 18px 0 22px; }
.tabs button { flex: 1; padding: 11px 4px; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 700; font-size: 15px; }
.tabs button.on { background: var(--green); color: var(--button-text); }
label.f { display: block; margin: 16px 0 6px; font-weight: 700; font-size: 15px; }
input.t, textarea.t, select.t { width: 100%; background: var(--card); border: 1.5px solid #33506E; color: var(--ink); border-radius: var(--radius-sm); padding: 14px 16px; font-size: 16px; outline: none; }
input.t:focus, textarea.t:focus { border-color: var(--green); }
input.t::placeholder { color: #7E93A8; }
.form-note { margin: 14px 0; }

/* Ficha de negocio */
.back-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 12px; }
.back-row .who { color: var(--muted); font-size: 14px; }
.store-head { display: flex; gap: 16px; align-items: center; }
.store-head .avatar { width: 60px; height: 60px; border-radius: 15px; background: var(--green-deep); color: var(--green); display: grid; place-items: center; font-size: 22px; font-weight: 800; flex: none; overflow: hidden; }
.store-head .avatar img { width: 100%; height: 100%; object-fit: cover; }
.store-head h2 { font-size: 20px; }
.store-head .sub { color: var(--muted); margin-top: 3px; }
.kv { margin-top: 6px; color: var(--muted); }
.install-note { font-size: 13px; line-height: 1.45; }
.kv b { color: var(--ink); font-weight: 600; }

/* Detalle de publicación */
.gallery { border-radius: var(--radius); overflow: hidden; background: var(--green-deep); position: relative; }
.gallery .strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; touch-action: pan-x pan-y; }
.gallery .strip::-webkit-scrollbar { display: none; }
.gallery .strip img { width: 100%; min-width: 100%; aspect-ratio: 4/3; object-fit: cover; scroll-snap-align: center; }
.gallery .navb { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(13,22,35,.75); color: var(--ink); font-size: 20px; line-height: 1; }
.gallery .prev { left: 8px; } .gallery .next { right: 8px; }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.gallery .count { position: absolute; right: 12px; bottom: 12px; background: rgba(13,22,35,.8); color: var(--ink); font-size: 13px; padding: 3px 10px; border-radius: 999px; }
.report-link { color: #E89AA4; font-size: 13px; }

/* Avisos */
.notice { background: var(--card); border-left: 4px solid var(--gold); border-radius: var(--radius-sm); padding: 14px 16px; margin: 16px 0; color: var(--ink); font-size: 14.5px; }
.notice.green { border-left-color: var(--green); }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }

/* Barra inferior */
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 6px 14px calc(8px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); }
.bottomnav .bar { max-width: 688px; margin: 0 auto; background: var(--card); border-radius: 999px; display: flex; padding: 6px; }
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 7px 2px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 11px; white-space: normal; text-align: center; line-height: 1.15; } /* «Mis publicaciones» (24nov) cabe en dos líneas centradas */
.bottomnav a.on { color: var(--green); }
.bottomnav a svg { width: 20px; height: 20px; flex: none; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 110px; background: var(--card); border: 1px solid #33506E; color: var(--ink); padding: 12px 18px; border-radius: 999px; font-size: 14.5px; z-index: 30; max-width: 90%; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.4); }

@media (max-width: 360px) {
  .topbar h1 { font-size: 20px; }
  .section h2 { font-size: 17px; }
  .cats { gap: 7px; }
  .cat { font-size: 12.5px; padding: 9px 4px; }
}

/* Presentación: nombre público de tienda/vendedor en MAYÚSCULAS sólo en tarjetas (no altera datos) */
.seller-name { text-transform: uppercase; }

/* Visor ampliado de fotos: el zoom por pellizco solo vive aquí dentro */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.94); z-index: 99; display: flex; align-items: center; justify-content: center; }
.lightbox .lb-close { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 22px; }
.lightbox .navb { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.28); color: #fff; font-size: 24px; z-index: 3; }
.lightbox .zoomb { position: absolute; bottom: 16px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.28); color: #fff; font-size: 22px; z-index: 3; }
.lightbox .zin { right: 70px; } .lightbox .zout { right: 124px; }
.lightbox .lb-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.lightbox .lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center; user-select: none; -webkit-user-drag: none; }
.lightbox .prev { left: 10px; } .lightbox .next { right: 10px; }
.lightbox .count { position: absolute; bottom: 16px; right: 16px; color: #fff; font-size: 13px; background: rgba(255,255,255,.15); padding: 3px 10px; border-radius: 999px; }

/* Escritorio / PC (≥900px, incluye "ver como ordenador" en Android): aprovecha el ancho
   sin tocar la vista móvil. Misma estructura HTML, solo distribución. */
@media (min-width: 900px) {
  .app { max-width: 1200px; padding: 0 24px 48px; display: flex; flex-direction: column; }
  .topbar { order: -2; padding: 18px 0 12px; }
  .topbar .logo { width: 46px; height: 46px; }
  .topbar h1 { font-size: 24px; }
  /* Menú como barra superior fija, tamaño escritorio */
  .bottomnav { order: -1; position: sticky; top: 0; bottom: auto; padding: 0 0 12px; background: var(--bg); z-index: 20; }
  .bottomnav .bar { max-width: 1200px; border-radius: 14px; }
  .bottomnav a { flex-direction: row; gap: 8px; font-size: 13.5px; padding: 11px 16px; }
  /* Buscador tamaño escritorio bajo la barra */
  .search { top: 64px; max-width: 760px; width: 100%; margin: 0 auto; padding: 12px 18px; }
  .search input { font-size: 15px; }
  /* Más publicaciones y categorías por fila */
  .grid2 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
  .cats { grid-template-columns: repeat(6, 1fr); gap: 12px; }
  .carousel .pub { flex: none; width: 220px; }
  .section { margin-top: 22px; }
  .section h2 { font-size: 21px; }
  /* Formularios de cuenta centrados y con ancho razonable */
  .tabs, #form, #form + div, #rc-form { max-width: 560px; margin-left: auto; margin-right: auto; width: 100%; }
  .tabs { margin: 18px auto 22px; }
  /* Detalle: fotos grandes pero no a todo el ancho */
  .gallery { max-width: 760px; margin: 0 auto; }
}

/* Favoritos 060: corazón sobre la foto y en el detalle */
.pub .ph { position: relative; }
.fav-heart { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(13,22,35,.72); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 7px; z-index: 2; }
.fav-heart svg { width: 20px; height: 20px; }
.fav-heart.on { color: var(--green); }
.fav-heart.on svg { fill: var(--green); }
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.title-row .fav-heart { position: static; flex: 0 0 auto; background: var(--card); }

/* Modal propio de confirmación/entrada (sustituye confirm/prompt nativos) */
.publy-modal { position: fixed; inset: 0; background: rgba(4, 10, 18, .62); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 26px; }
.publy-modal-card { background: var(--card); border-radius: var(--radius-sm); padding: 18px; width: 100%; max-width: 340px; box-shadow: 0 12px 40px rgba(0,0,0,.45); }
.publy-modal-msg { color: var(--ink); font-size: 14.5px; line-height: 1.5; }
.publy-modal-input { margin-top: 12px; width: 100%; }
.publy-modal-row { display: flex; gap: 10px; margin-top: 16px; }
.publy-modal-row .btn { flex: 1; margin-top: 0; }

/* Búsqueda fija en Tiendas: queda visible al desplazarse por la lista (25nov).
   Fondo opaco para que el contenido no se vea a través; sin tapar la navegación. */
.sticky-search { position: sticky; top: 0; z-index: 25; background: var(--bg); padding: 8px 0 6px; margin-top: 2px; }
@media (min-width: 900px) { .sticky-search { top: 64px; } }

/* Encabezado turquesa estilo APK (Mi perfil, Mis publicaciones, Mi membresía) */
.topbar.apk { background: var(--green); color: var(--button-text); border-radius: 0 0 18px 18px; margin: 0 -14px; padding: 14px 16px; }
@media (min-width: 900px) { .topbar.apk { margin: 0 -24px; } }
.topbar.apk h1, .topbar.apk .apk-sub { color: var(--button-text); text-align: center; }
.topbar.apk .apk-title { flex: 1; text-align: center; }
.topbar.apk .apk-sub { font-weight: 700; font-size: 16px; letter-spacing: .5px; }
.topbar.apk .bell svg { stroke: var(--button-text); }
