/* =====================================================================
   PUEBLER — Publicaciones: pasabordo (etiqueta y código de barras),
   menú de tres puntos, estadísticas, silenciados y postal digital.
   ===================================================================== */

/* ---------- Pasabordo: pie con etiqueta amarilla y código escaneable ---------- */
.pb-ticket-foot { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px 14px; margin-top: 12px; }
.pb-ticket-pax { min-width: 0; }
.pb-ticket-pax b { display: block; font-size: .72rem; letter-spacing: .16em; }
.pb-ticket-pax small { display: block; font-size: .6rem; color: #64748B; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-ticket-label {
  justify-self: center; text-align: center; max-width: 100%;
  background: #FEF08A; color: #0B1D3A; border: 1.5px solid #0B1D3A; border-radius: 6px;
  padding: 5px 12px 6px; font-family: 'Courier New', ui-monospace, monospace; font-size: .7rem; font-weight: 800; letter-spacing: .1em; line-height: 1.2;
  transform: rotate(-1.5deg); box-shadow: 2px 2px 0 #0B1D3A;
}
.pb-ticket-label span { display: block; font-size: .6rem; font-weight: 700; letter-spacing: .02em; text-transform: none; }
.pb-ticket-id { font-size: .62rem; font-weight: 800; color: #64748B; letter-spacing: .06em; white-space: nowrap; }
.pb-ticket-code {
  display: block; width: 100%; margin-top: 12px; padding: 0; border: 1px solid #CBD5E1; border-radius: 10px; background: #FFFFFF;
  cursor: zoom-in; overflow: hidden; text-align: center; color: #0B1D3A;
}
.pb-ticket-code:hover { border-color: #0B1D3A; }
.pb-ticket-code:focus-visible { outline: 3px solid var(--puebler-blue); outline-offset: 2px; }
.pb-ticket-code .pp-barcode { display: block; width: 100%; height: auto; min-height: 70px; }
.pb-ticket-code-hint { display: block; padding: 4px 8px 6px; font-size: .66rem; font-weight: 700; color: #64748B; border-top: 1px dashed #E2E8F0; }
@media (max-width: 575px) {
  .pb-ticket-foot { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .pb-ticket-label { justify-self: start; transform: rotate(-1deg); }
}

/* ---------- Diálogos: embeber y código ampliado ---------- */
.ps-embed { text-align: left; }
.ps-embed-help { font-size: .88rem; color: var(--puebler-text-muted); margin: 0 0 10px; }
.ps-embed-code { width: 100%; font-family: ui-monospace, 'Courier New', monospace; font-size: .78rem; resize: none; }
.ps-embed-label { font-size: .74rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--puebler-text-muted); margin: 14px 0 6px; }
.ps-embed-preview { width: 100%; height: 360px; border: 1px solid var(--puebler-border); border-radius: 12px; background: var(--puebler-surface-2); }
.ps-barcode-big { background: #FFFFFF; border-radius: 12px; padding: 6px; border: 1px solid #E2E8F0; }
.ps-barcode-big svg { width: 100%; height: auto; display: block; }
.ps-barcode-url { margin: 10px 0 0; font-family: ui-monospace, monospace; font-size: .85rem; word-break: break-all; }

/* ---------- Publicación oculta / autor silenciado ---------- */
.pb-post.is-collapsed { padding-top: 12px; padding-bottom: 12px; }
.ps-collapsed { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .9rem; color: var(--puebler-text-muted); }
.ps-collapsed > i { font-size: 1.1rem; }
.ps-collapsed > span:first-of-type { flex: 1 1 220px; }
.ps-collapsed-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.ps-undo { border: 0; background: none; padding: 0; color: var(--puebler-blue-dark); font-weight: 700; font-size: .88rem; }
.ps-undo:hover { text-decoration: underline; }
.ps-muted li { padding: 12px 0; border-bottom: 1px solid var(--puebler-border-soft); transition: opacity .25s ease; }
.ps-muted li.is-leaving { opacity: 0; }

/* ---------- Estadísticas ---------- */
.ps-stats { background: var(--puebler-surface); min-height: calc(100vh - var(--topbar-h)); }
.ps-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; padding: 26px 28px 18px; border-bottom: 1px solid var(--puebler-border); }
.ps-head .pb-page-title { overflow-wrap: anywhere; }
.ps-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-bottom: 1px solid var(--puebler-border); }
.ps-kpi { padding: 18px 22px; border-right: 1px solid var(--puebler-border); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ps-kpi:last-child { border-right: 0; }
.ps-kpi i { color: var(--puebler-blue); font-size: 1.1rem; }
.ps-kpi strong { font-family: var(--font-heading); font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.ps-kpi span { font-size: .72rem; color: var(--puebler-text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.ps-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ps-block { padding: 22px 28px; border-bottom: 1px solid var(--puebler-border); border-right: 1px solid var(--puebler-border); min-width: 0; }
.ps-block:nth-child(3n + 1):not(.ps-wide), .ps-block:last-child { border-right: 0; }
.ps-wide { grid-column: 1 / -1; border-right: 0; }
.ps-block h2 { font-size: 1rem; font-weight: 800; margin: 0 0 12px; }
.ps-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; font-weight: 600; color: var(--puebler-text-muted); margin-bottom: 10px; }
.ps-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.ps-chart-wrap { width: 100%; overflow: hidden; }
.ps-chart { width: 100%; max-width: 1000px; height: auto; display: block; color: var(--puebler-text); }
.ps-rows { list-style: none; padding: 0; margin: 0; }
.ps-rows li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--puebler-border-soft); font-size: .9rem; }
.ps-rows li > i, .ps-rows li > svg { width: 20px; text-align: center; color: var(--puebler-text-muted); flex-shrink: 0; }
.ps-rows li span { flex: 1; min-width: 0; }
.ps-src { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; font-size: .86rem; font-weight: 600; margin-bottom: 10px; }
.ps-src .pb-progress { grid-column: span 2; height: 6px; }
.ps-hours { width: 100%; height: auto; color: var(--puebler-text); }
.ps-note { padding: 16px 28px 30px; margin: 0; font-size: .8rem; color: var(--puebler-text-muted); }
.ps-table-wrap { overflow-x: auto; }
.ps-table { width: 100%; min-width: 760px; margin: 0; }
.ps-table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--puebler-text-muted); white-space: nowrap; padding: 12px 14px; }
.ps-table td { padding: 12px 14px; vertical-align: middle; border-top: 1px solid var(--puebler-border-soft); }
.ps-table th:first-child, .ps-table td:first-child { padding-left: 28px; }
.ps-table th:last-child, .ps-table td:last-child { padding-right: 28px; }
.ps-post-cell { display: flex; gap: 10px; align-items: center; color: var(--puebler-text); min-width: 240px; max-width: 460px; }
.ps-post-cell span { display: flex; flex-direction: column; min-width: 0; }
.ps-post-cell strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }
.ps-post-cell small { color: var(--puebler-text-muted); font-size: .78rem; }
@media (max-width: 991px) {
  .ps-grid { grid-template-columns: 1fr; }
  .ps-block { border-right: 0; }
}
@media (max-width: 767px) {
  .ps-head, .ps-block { padding-left: 14px; padding-right: 14px; }
  .ps-note { padding: 14px; }
  .ps-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ps-kpi { padding: 14px; border-bottom: 1px solid var(--puebler-border); }
  .ps-kpi:nth-child(2n) { border-right: 0; }
  .ps-kpi strong { font-size: 1.4rem; }
  .ps-table th:first-child, .ps-table td:first-child { padding-left: 14px; }
}

/* ---------- Postal digital ---------- */
.pc-page { background: var(--puebler-surface); min-height: calc(100vh - var(--topbar-h)); padding: 22px 28px 40px; }
.pc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 18px; flex-wrap: wrap; margin-bottom: 18px; }
.pc-title { font-family: var(--font-serif); font-size: 1.8rem; font-weight: 800; margin: 0 0 4px; overflow-wrap: anywhere; }
.pc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.pc-stage { position: relative; min-width: 0; }
.pc-canvas {
  display: block; width: min(100%, calc((100dvh - var(--topbar-h) - 150px) * 1.5)); height: auto; aspect-ratio: 3 / 2; margin: 0 auto;
  border-radius: 6px; box-shadow: 0 18px 40px rgba(20, 30, 50, .18); background: #F7F1E3;
}
.pc-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; color: var(--puebler-text-muted); background: #F7F1E3; border-radius: 6px; }
.pc-loading[hidden] { display: none; }
.pc-panel { display: flex; flex-direction: column; gap: 16px; }
.pc-field label { display: flex; justify-content: space-between; font-weight: 800; font-size: .9rem; margin-bottom: 6px; }
.pc-field textarea { resize: vertical; }
.pc-actions { display: flex; flex-direction: column; gap: 10px; }
.pc-actions .pb-btn { justify-content: center; }
.pc-note { font-size: .8rem; color: var(--puebler-text-muted); margin: 0; }
@media (max-width: 1100px) {
  .pc-layout { grid-template-columns: 1fr; }
  .pc-canvas { width: 100%; }
  .pc-panel { max-width: 640px; }
}
@media (max-width: 767px) {
  .pc-page { padding: 16px 14px 32px; }
  .pc-title { font-size: 1.35rem; }
  .pc-layout { gap: 18px; }
}

/* Código ampliado: en escritorio ocupa casi todo el ancho; en vertical se gira para usar el alto. */
.pb-swal.ps-swal-code { width: min(1100px, 96vw) !important; max-width: 96vw; }
.ps-barcode-big.is-rotated { height: min(62dvh, 620px); width: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 0; }
.ps-barcode-big.is-rotated svg { flex-shrink: 0; transform: rotate(90deg); }
.pb-swal.ps-swal-embed { width: min(640px, 96vw) !important; }

/* ---------- Edición de publicaciones e historial ---------- */
.pb-back { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; font-weight: 700; color: var(--puebler-text-muted); text-decoration: none; margin-bottom: 14px; }
.pb-back:hover { color: var(--puebler-navy, #16253B); }
.pb-edit-post { max-width: 780px; margin: 0 auto; }
.pb-edit-head { margin-bottom: 18px; }
.pb-edit-locked { display: grid; gap: 0; margin: 0 0 22px; border-top: 1px solid var(--puebler-border); }
.pb-edit-locked > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--puebler-border); font-size: .88rem; }
.pb-edit-locked dt { font-weight: 800; color: var(--puebler-text-muted); display: flex; gap: 6px; align-items: center; }
.pb-edit-locked dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.pb-edit-vis { max-width: 320px; }
.pb-edit-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
@media (max-width: 575px) { .pb-edit-locked > div { grid-template-columns: minmax(0, 1fr); gap: 2px; } .pb-edit-actions .pb-btn { flex: 1 1 auto; justify-content: center; } }
.pb-edited { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.pb-edited:hover, .pb-edited:focus-visible { color: var(--puebler-text, #16253B); }
.pb-history { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--puebler-border); }
.pb-history > li { padding: 16px 0; border-bottom: 1px solid var(--puebler-border); }
.pb-history-when { font-size: .82rem; font-weight: 800; color: var(--puebler-text-muted); margin-bottom: 10px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pb-history-change { display: grid; grid-template-columns: 120px minmax(0, 1fr) minmax(0, 1fr); gap: 10px; padding: 8px 0; font-size: .88rem; }
.pb-history-label { font-weight: 800; }
.pb-history-before, .pb-history-after { min-width: 0; overflow-wrap: anywhere; padding: 8px 10px; border-radius: 8px; background: var(--puebler-surface-2); }
.pb-history-before { border-left: 3px solid #CBD5E1; }
.pb-history-after { border-left: 3px solid #0B9DB0; }
.pb-history-before > span, .pb-history-after > span { display: block; font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--puebler-text-muted); margin-bottom: 2px; }
@media (max-width: 767px) { .pb-history-change { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Videos en el feed ---------- */
.pb-videos { margin-top: 12px; display: grid; gap: 4px; }
.pb-videos.is-multi { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.pb-video { position: relative; margin: 0; border-radius: 14px; overflow: hidden; background: #0B1220; }
.pb-video-el { display: block; width: 100%; max-height: 560px; aspect-ratio: 4 / 5; object-fit: cover; background: #0B1220; }
.pb-video-open { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; }
.pb-video-play { width: 58px; height: 58px; border-radius: 50%; background: rgba(11, 18, 32, .55); border: 2px solid rgba(255, 255, 255, .85); display: flex; align-items: center; justify-content: center; font-size: 1.9rem; opacity: .92; transition: transform .15s; }
.pb-video-open:hover .pb-video-play, .pb-video-open:focus-visible .pb-video-play { transform: scale(1.08); }
.pb-video-open:focus-visible { outline: 3px solid var(--puebler-blue, #0B9DB0); outline-offset: -3px; }
.pb-video-tag, .pb-video-more { position: absolute; top: 10px; left: 10px; display: inline-flex; gap: 5px; align-items: center; background: rgba(11, 18, 32, .72); color: #fff; font-size: .72rem; font-weight: 800; padding: 4px 9px; border-radius: 20px; pointer-events: none; }
.pb-video-more { left: auto; right: 10px; }
.pb-video-sound { position: absolute; right: 10px; bottom: 10px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(11, 18, 32, .72); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; z-index: 2; }
.pb-video-sound:focus-visible { outline: 3px solid #fff; }
.pb-preview-video { position: relative; border-radius: 8px; overflow: hidden; background: #0B1220; }
.pb-preview-video video { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.pb-preview-video span { position: absolute; left: 6px; bottom: 6px; background: rgba(11, 18, 32, .75); color: #fff; font-size: .68rem; font-weight: 800; padding: 2px 7px; border-radius: 10px; }
.pb-typechip-reels { margin-left: 4px; }

/* ---------- Visor de reels (se desliza a los lados) ---------- */
body.pb-reels-open { overflow: hidden; }
.pb-reels { position: fixed; inset: 0; z-index: 2000; background: #0B1220; color: #fff; display: flex; flex-direction: column; }
.pb-reels-top { position: absolute; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; pointer-events: none; }
.pb-reels-top > * { pointer-events: auto; }
.pb-reels-brand { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 1rem; display: inline-flex; gap: 8px; align-items: center; background: rgba(11, 18, 32, .6); padding: 6px 12px; border-radius: 20px; }
.pb-reels-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(11, 18, 32, .6); color: #fff; font-size: 1.15rem; display: flex; align-items: center; justify-content: center; }
.pb-reels-btn:hover { background: rgba(255, 255, 255, .16); }
.pb-reels-btn:focus-visible, .pb-reels-nav:focus-visible, .pb-reel-act:focus-visible { outline: 3px solid #0B9DB0; outline-offset: 2px; }
.pb-reels-track {
  flex: 1 1 auto; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior: contain;
  touch-action: pan-x; scrollbar-width: none; -webkit-overflow-scrolling: touch; outline: none;
}
.pb-reels-track::-webkit-scrollbar { display: none; }
.pb-reel { flex: 0 0 100%; width: 100%; height: 100%; position: relative; scroll-snap-align: center; scroll-snap-stop: always; overflow: hidden; }
.pb-reel-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; }
.pb-reel-video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.pb-reel-tap { position: absolute; inset: 0; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #fff; }
.pb-reel-state { width: 72px; height: 72px; border-radius: 50%; background: rgba(11, 18, 32, .55); display: flex; align-items: center; justify-content: center; font-size: 2.4rem; opacity: 0; transition: opacity .2s; }
.pb-reel.is-paused .pb-reel-state { opacity: 1; }
.pb-reel-info {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 14px 76px calc(16px + env(safe-area-inset-bottom)) 16px;
  background: rgba(11, 18, 32, .66); display: flex; flex-direction: column; gap: 6px; max-height: 46%; overflow-y: auto;
}
.pb-reel-author { display: flex; gap: 10px; align-items: center; min-width: 0; }
.pb-reel-author img { border: 2px solid #fff; flex: 0 0 auto; }
.pb-reel-who { min-width: 0; line-height: 1.2; }
.pb-reel-name { color: #fff; font-weight: 800; text-decoration: none; margin-right: 4px; }
.pb-reel-name:hover { text-decoration: underline; }
.pb-reel-handle { display: block; font-size: .76rem; color: rgba(255, 255, 255, .75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-reel-dest { color: #fff; font-size: .82rem; font-weight: 700; text-decoration: none; display: inline-flex; gap: 5px; align-items: center; }
.pb-reel-dest i { color: #FF7A59; }
.pb-reel-title { font-size: .95rem; }
.pb-reel-caption { font-size: .88rem; line-height: 1.45; overflow-wrap: anywhere; }
.pb-reel-caption a { color: #9BE7F0; }
.pb-reel-link { color: #9BE7F0; font-size: .8rem; font-weight: 800; text-decoration: none; }
.pb-reel-actions { position: absolute; right: 8px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 3; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.pb-reel-act {
  width: 50px; min-height: 50px; border: 0; border-radius: 26px; background: rgba(11, 18, 32, .6); color: #fff; font-size: 1.35rem; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 6px 0;
}
.pb-reel-act:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.pb-reel-act.is-on, .pb-reel-act.is-saved { color: #FFC857; }
.pb-reel-act .pb-action-label { display: none; }
.pb-reel-count { font-size: .68rem; font-weight: 800; color: #fff; line-height: 1; }
.pb-reel-actions .pb-react-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pb-reel-actions .pb-react-picker { bottom: 0; left: auto; right: calc(100% + 8px); color: var(--puebler-text); }
.pb-reels-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 4; width: 52px; height: 52px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 1.4rem; display: none; align-items: center; justify-content: center;
}
.pb-reels-nav:hover:not(:disabled) { background: rgba(255, 255, 255, .26); }
.pb-reels-nav:disabled { opacity: .3; cursor: default; }
.pb-reels-nav.is-prev { left: 18px; }
.pb-reels-nav.is-next { right: 18px; }
.pb-reels-hint {
  position: absolute; top: calc(64px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 4; margin: 0;
  background: rgba(11, 18, 32, .72); color: #fff; font-size: .78rem; font-weight: 700; padding: 6px 14px; border-radius: 20px; white-space: nowrap;
  display: inline-flex; gap: 6px; align-items: center; pointer-events: none; transition: opacity .4s;
}
.pb-reels.was-swiped .pb-reels-hint, .pb-reels.is-loading .pb-reels-hint { opacity: 0; }
.pb-reels-loading, .pb-reels-empty { flex: 0 0 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 24px; }
.pb-reels-empty i { font-size: 2.6rem; opacity: .7; }
.pb-reels-empty a { color: #9BE7F0; }

@media (min-width: 992px) {
  .pb-reels-nav { display: flex; }
  .pb-reels-hint { display: none; }
  .pb-reel { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 72px 96px 24px; }
  .pb-reel-stage { position: relative; inset: auto; height: 100%; aspect-ratio: 9 / 16; max-width: 46vw; border-radius: 16px; overflow: hidden; flex: 0 1 auto; }
  .pb-reel-actions { position: static; align-self: flex-end; margin-bottom: 8px; }
  .pb-reel-info { position: static; background: transparent; width: 320px; max-height: 100%; padding: 0; align-self: flex-end; flex: 0 0 320px; margin-bottom: 8px; }
  .pb-reel-actions .pb-react-picker { right: auto; left: calc(100% + 8px); }
}
@media (prefers-reduced-motion: reduce) { .pb-reels-track { scroll-behavior: auto; } .pb-video-play { transition: none; } }
