body {
  margin: 0; background: #F3F7F6; color: #1C2423;
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
.bar {
  position: sticky; top: 0; z-index: 4; display: flex; align-items: center; height: 52px;
  background: rgba(243,247,246,.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(28,36,35,.06);
}
.icon-btn { width: 48px; height: 52px; flex: none; display: grid; place-items: center; color: #1C2423; }
.icon-btn svg { width: 24px; height: 24px; }
.bar-title {
  flex: 1; min-width: 0; font-weight: 700; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.detail { max-width: 600px; margin: 8px auto 16px; }
.post { background: #fff; }
.post-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px 0; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex: none;
  background: rgba(11,110,110,.12); color: #0B6E6E; display: grid; place-items: center; font-weight: 700;
}
.avatar.app-icon {
  border-radius: 12px; background: #fff;
  box-shadow: 0 0 0 1px rgba(28,36,35,.08);
}
.avatar.sm.app-icon { border-radius: 8px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 36px; height: 36px; font-size: 13px; }
.who { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.name { font-weight: 700; }
.pond { display: flex; align-items: center; gap: 2px; color: #F2994A; font-size: 12px; font-weight: 700; }
.pond svg { width: 14px; height: 14px; flex: none; }
.post-head time { color: rgba(28,36,35,.55); font-size: 12px; }
.post-title { margin: 12px 16px 0; font-size: 16px; line-height: 1.25; font-weight: 800; }
.post-body.full { margin: 8px 16px 0; line-height: 1.45; white-space: normal; }
.md h2, .md h3 { margin: 14px 0 6px; line-height: 1.25; font-weight: 800; }
.md h2 { font-size: 18px; }
.md h3 { font-size: 16px; }
.md p, .md ul, .md ol { margin: 0 0 8px; }
.md ul, .md ol { padding-left: 20px; }
.md a { color: #1565C0; }
.post-body.full img {
  display: block; width: 100%; height: auto; max-width: 100%;
  margin: 12px 0; border-radius: 8px; background: #E7EEEC; object-fit: contain;
}
.media-grid {
  display: grid; gap: 3px; margin: 12px 16px 0;
  border-radius: 12px; overflow: hidden; background: #E7EEEC;
}
.media-grid .tile { position: relative; display: block; min-width: 0; min-height: 0; overflow: hidden; }
.media-grid img { width: 100%; height: 100%; object-fit: cover; display: block; background: #E7EEEC; }
.media-grid.one { aspect-ratio: 4 / 3; }
.media-grid.two { aspect-ratio: 16 / 9; grid-template-columns: 1fr 1fr; }
.media-grid.three { aspect-ratio: 4 / 3; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.media-grid.three .tile:first-child { grid-row: 1 / span 2; }
.media-grid.four { aspect-ratio: 4 / 3; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.media-grid .play, .media-grid .more-photos {
  position: absolute; inset: 0; display: grid; place-items: center;
}
.media-grid .play svg { width: 52px; height: 52px; }
.media-grid .more-photos {
  background: rgba(0,0,0,.45); color: #fff; font-size: 28px; font-weight: 800;
}
@media (min-width: 480px) {
  .media-grid.one { aspect-ratio: 16 / 9; }
  .media-grid.three, .media-grid.four { aspect-ratio: 16 / 10; }
}
.event { display: flex; flex-direction: column; gap: 6px; margin: 10px 16px 0; }
.event-row { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 14px; line-height: 1.35; }
.event-row svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.event-row.em { font-weight: 800; }
.event-extra { display: none; flex-direction: column; gap: 6px; }
.event.is-open .event-extra, .event.is-expanded .event-extra { display: flex; }
.event-label { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; font-size: 13px; font-weight: 700; color: rgba(28,36,35,.65); }
.event-label svg { width: 16px; height: 16px; }
.event-note { margin: 0; line-height: 1.45; font-size: 14px; white-space: pre-wrap; }
.event-toggle { align-self: flex-start; margin-top: 2px; border: 0; padding: 0; background: none; color: #2F80ED; font-weight: 700; font-size: 14px; font-family: inherit; cursor: pointer; }
.event.is-expanded .event-toggle { display: none; }
.event-register {
  margin-top: 6px; height: 44px; border: 0; border-radius: 12px;
  background: #EB5757; color: #fff; font-weight: 800; font-size: 15px; font-family: inherit; cursor: pointer;
}
.event-register.is-cancel { background: transparent; color: #EB5757; border: 1px solid rgba(235,87,87,.55); }
.event-register.is-loading {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(28,36,35,.08); color: rgba(28,36,35,.55); cursor: wait; border: 0;
}
.event-register.is-loading::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(28,36,35,.18); border-top-color: #0B6E6E;
  animation: reg-spin .7s linear infinite;
}
@keyframes reg-spin { to { transform: rotate(360deg); } }
.event-register[disabled] { background: rgba(28,36,35,.12); color: rgba(28,36,35,.38); cursor: default; border: 0; }
.event-register.is-loading[disabled] { cursor: wait; color: rgba(28,36,35,.55); background: rgba(28,36,35,.08); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 22px;
  background: rgba(28,36,35,.05); border: 1px solid rgba(28,36,35,.10);
  color: rgba(28,36,35,.48); font-size: 13px; font-weight: 700;
}
.chip svg { width: 18px; height: 18px; }
.chip.icon-only { padding: 8px 10px; }
.comments { margin-top: 10px; background: #fff; padding: 12px 0 16px; }
.comments h2 { margin: 0 16px 4px; font-size: 16px; font-weight: 800; }
.comment { display: flex; gap: 10px; padding: 10px 16px; align-items: flex-start; }
.comment-body { flex: 1; min-width: 0; }
.comment-meta { margin: 2px 0 0; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.comment-meta .name { font-weight: 700; }
.comment-meta time { color: rgba(28,36,35,.45); font-size: 12px; font-weight: 500; }
.comment-text { margin: 2px 0 0; line-height: 1.4; overflow-wrap: anywhere; word-break: break-word; }
.comment-images { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.comment-images img { width: 88px; height: 88px; object-fit: cover; border-radius: 10px; background: #EDF2F0; flex: none; }
.more {
  display: block; margin: 4px auto 12px; border: 0; background: transparent;
  color: #0B6E6E; font-weight: 700; font-size: 14px; font-family: inherit; cursor: pointer;
}
.more[hidden] { display: none; }
button.chip { font: inherit; cursor: pointer; }
.post-detail-pane { display: contents; }
.post-detail-scroll { display: contents; }
.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  width: min(600px, 100%); margin-inline: auto; box-sizing: border-box;
  display: flex; align-items: center; gap: 10px;
  min-height: 64px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid rgba(28,36,35,.08);
}
.composer input {
  flex: 1; min-width: 0; border: 0; background: #F3F7F6; border-radius: 20px; padding: 10px 14px; font: inherit;
}
.composer button {
  position: relative; min-width: 76px; flex: none;
  border: 0; background: #0B6E6E; color: #fff; font-weight: 700; font-size: 14px; font-family: inherit;
  border-radius: 18px; padding: 10px 14px; cursor: pointer;
}
.composer button:disabled { cursor: default; opacity: .72; }
.composer.is-sending input { opacity: .6; }
.composer.is-sending button { color: transparent; }
.composer.is-sending button::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff; border-radius: 50%;
  animation: comment-spin .7s linear infinite;
}
.comment.is-new { animation: comment-in .35s ease; }
@keyframes comment-spin { to { transform: rotate(360deg); } }
@keyframes comment-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (min-width: 720px) {
  .detail { max-width: 600px; margin: 8px auto 16px; }
  .post, .comments { border-radius: 14px; overflow: hidden; }
  .composer { border-radius: 14px 14px 0 0; }
}
/* Shell 3 cột: cột giữa = scroll + composer trong flow (không fixed đè nội dung). */
@media (min-width: 1100px) {
  body.has-php-inbox { padding-bottom: 0 !important; }
  body.has-php-inbox .post-detail-pane {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 16px);
    position: sticky;
    top: 8px;
    min-width: 0;
    background: #F3F7F6;
    border-radius: 14px;
    overflow: hidden;
  }
  body.has-php-inbox .post-detail-pane > .bar {
    flex: none;
    border-radius: 14px 14px 0 0;
  }
  body.has-php-inbox .post-detail-scroll {
    display: block;
    flex: 1;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Cùng cột đọc 600px như bảng tin (.feed). */
  body.has-php-inbox .detail {
    max-width: 600px;
    margin: 12px auto 8px;
    padding-bottom: 8px;
  }
  body.has-php-inbox .composer {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    width: min(600px, 100%);
    max-width: 600px;
    margin: 0 auto;
    flex: none;
    border-radius: 14px 14px 0 0;
    padding-bottom: 10px;
    z-index: 1;
  }
}
