/* TumbuhBareng: komponen inti komunitas (feed, post, komentar, leaderboard, anggota, notifikasi, admin).
   Hanya token dari style.css + --danger dari app.css. */

/* ---------- feed ---------- */
.feed { padding-top: 22px; }
.composer { padding: 0; overflow: hidden; }
.composer > summary { list-style: none; display: flex; align-items: center; gap: 14px; padding: 16px 20px; cursor: pointer; }
.composer > summary::-webkit-details-marker { display: none; }
.composer .fake-input { flex: 1; min-width: 0; height: 44px; display: flex; align-items: center; padding: 0 16px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer[open] > summary { border-bottom: 1px solid var(--line); }
.composer[open] > summary .btn { display: none; }
.composer > form { padding: 20px; }
.join-hint { gap: 14px; font-size: 14px; }
.feed-cats { display: flex; gap: 8px; flex-wrap: wrap; margin: 22px 0 6px; }
.feed-sort .tabs { margin-top: 8px; }
.mark-all { margin-top: 14px; display: flex; justify-content: flex-end; }

.prow { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.prow.has-thumb { grid-template-columns: minmax(0, 1fr) 150px; }
.prow-main { display: grid; gap: 8px; min-width: 0; align-content: start; }
.prow-meta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.prow-meta .who { display: grid; min-width: 0; line-height: 1.3; }
.prow-meta .name, .post-head .name, .cmt-head .name, .mrow .name { font-weight: 500; }
.prow-meta .name:hover, .post-head .name:hover, .cmt-head .name:hover, .mrow .name:hover { color: var(--accent-text); }
.prow-meta .cat:hover { color: var(--accent-text); }
.pin-tag { margin-left: auto; flex: none; }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; box-shadow: 0 0 0 3px var(--accent-soft); margin-left: auto; }
.pin-tag + .unread-dot { margin-left: 6px; }
.prow-meta .who .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats a { display: inline-flex; align-items: center; gap: 6px; }
.prow h3 { font-size: 18px; font-weight: 500; line-height: 1.35; letter-spacing: -0.01em; }
.prow h3 a:hover { color: var(--accent); }
.prow.unread h3 { font-weight: 600; }
.prow p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prow-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
.prow-foot .stats { flex-wrap: wrap; gap: 14px; }
.prow-foot .stats a:hover { color: var(--text); }
.contrib { display: inline-flex; align-items: center; gap: 8px; }
.stack { display: inline-flex; }
.stack img { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; margin-left: -6px; object-fit: cover; }
.stack img:first-child { margin-left: 0; }
.prow-thumb { position: relative; display: block; border-radius: 12px; overflow: hidden; align-self: start; }
.prow-thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; height: auto; }
.prow-thumb .play { position: absolute; left: 8px; bottom: 8px; width: 30px; height: 30px; border-radius: 50%; background: #fff; display: grid; place-items: center; color: var(--accent-text); }

.likebtn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; margin: -6px 0; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 14px; transition: background .15s, color .15s, border-color .15s; }
.likebtn:hover { border-color: #cfd4d1; color: var(--text); }
.likebtn.on { background: var(--accent-soft); border-color: #bfe5cf; color: var(--accent-text); }
.likebtn.on svg { fill: currentColor; }
.likebtn.big { height: 38px; padding: 0 16px; margin: 0; }
.save.on svg, .savebtn.on svg { fill: currentColor; }
.save.on { color: var(--accent-text); }
.savebtn.on { background: var(--accent-soft); border-color: #bfe5cf; color: var(--accent-text); }

/* ---------- detail post ---------- */
.post-crumbs { margin: 18px 0 0; }
.post-crumbs a { display: inline-flex; align-items: center; gap: 6px; }
.post-full { padding: 18px 0 26px; border-bottom: 1px solid var(--line); display: grid; gap: 16px; }
.post-head { display: flex; align-items: center; gap: 12px; }
.post-head .who { display: grid; line-height: 1.35; min-width: 0; }
.post-head .pin-tag { margin-left: auto; }
.post-head .more-dd { margin-left: auto; }
.post-head .pin-tag + .more-dd { margin-left: 0; }
.post-title { font-size: clamp(22px, 2.6vw, 28px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--ink); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.post-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.post-report summary, .cmt-actions summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.post-report summary::-webkit-details-marker, .cmt-actions summary::-webkit-details-marker { display: none; }
.post-report summary:hover, .cmt-actions summary:hover { color: var(--text); }
.post-report .form { margin-top: 12px; max-width: 460px; }

/* menu titik tiga */
.more-dd { position: relative; }
.more-dd > summary { list-style: none; cursor: pointer; }
.more-dd > summary::-webkit-details-marker { display: none; }
.more-dd .dd { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 230px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: 0 20px 40px -16px rgba(8,24,16,.3); display: grid; gap: 2px; }
.more-dd .dd > a, .more-dd .dd button:not(.btn) { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; font-size: 14px; width: 100%; text-align: left; }
.more-dd .dd > a:hover, .more-dd .dd button:not(.btn):hover { background: var(--soft); }
.more-dd .dd .danger, .cmt-link.danger { color: var(--danger); }
.more-dd .dd.form { padding: 14px; gap: 10px; }

/* ---------- komentar ---------- */
.comments { padding: 24px 0 10px; display: grid; gap: 18px; }
.cmt-new { display: flex; align-items: flex-start; gap: 12px; }
.cmt-new textarea, .cmt textarea { flex: 1; width: 100%; font: inherit; color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; min-height: 46px; resize: vertical; line-height: 1.5; background: #fff; }
.cmt-new textarea:focus, .cmt textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cmt-new .btn { align-self: flex-end; }
.cmts { display: grid; gap: 18px; }
.cmt { display: flex; gap: 12px; align-items: flex-start; scroll-margin-top: 90px; }
.cmt-body { flex: 1; min-width: 0; display: grid; gap: 6px; }
.cmt-bubble { background: var(--soft); border-radius: 4px 16px 16px 16px; padding: 12px 16px; }
.cmt:target > .cmt-body > .cmt-bubble { box-shadow: 0 0 0 2px var(--accent); }
.cmt-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; font-size: 14px; }
.cmt-text { font-size: 15px; line-height: 1.6; }
.cmt-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-left: 4px; }
.cmt-actions .likebtn { height: 28px; padding: 0 10px; margin: 0; font-size: 13px; }
.cmt-actions details[open] { flex-basis: 100%; order: 5; }
.cmt-actions details .form { margin-top: 10px; gap: 10px; }
.cmt-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.likes-ro { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.replies { display: grid; gap: 14px; margin-top: 8px; padding-left: 14px; border-left: 2px solid var(--line); }
.cmt.reply .cmt-bubble { background: #fff; border: 1px solid var(--line); }
.report-form select, .report-form input[type=text] { width: 100%; font: inherit; border: 1px solid var(--line); border-radius: 12px; height: 42px; padding: 0 12px; background: #fff; }

/* ---------- progress / level ---------- */
.progress { height: 8px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.progress.sm { height: 6px; margin-top: 6px; }
.lvl-mini { display: flex; align-items: center; gap: 12px; }
.lvl-mini > div { flex: 1; min-width: 0; }
.lvl-mini strong { display: block; font-weight: 500; }
.lvl-mini small { color: var(--muted); font-size: 13px; }
.lb-mini { list-style: none; display: grid; }
.lb-mini li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.lb-mini li a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-mini li a:hover { color: var(--accent-text); }
.lb-mini b { color: var(--accent-text); font-weight: 600; }
.rank { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--muted); flex: none; }
.rank.r1 { background: var(--accent); color: #fff; }
.rank.r2 { background: var(--accent-soft); color: var(--accent-text); }
.rank.r3 { background: #eceeed; color: var(--text); }

/* ---------- leaderboard ---------- */
.lb { padding-top: 22px; display: grid; gap: 22px; }
/* Dua kolom sama lebar: kiri profil + 7 hari + 30 hari, kanan Level + Sepanjang waktu, tepi kiri/kanan rata */
.lb-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.lb-me { display: flex; gap: 20px; align-items: center; }
.lb-me .stack-sm { flex: 1; min-width: 0; }
.lb-ill { width: 96px; height: 96px; border-radius: 16px; object-fit: cover; flex: none; }
.lb-next b { color: var(--accent-text); font-weight: 600; }
.lvl-list { list-style: none; display: grid; margin-top: 10px; }
.lvl-list li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.lvl-list li:last-child { border-bottom: 0; }
.lvl-list li.me { background: var(--accent-soft); margin: 0 -12px; padding: 8px 12px; border-radius: 10px; border-bottom-color: transparent; }
.lvl-badge { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none; }
.lvl-name { flex: 1; display: grid; line-height: 1.3; font-weight: 500; font-size: 14px; }
.lvl-name small { color: var(--muted); font-weight: 400; font-size: 12px; }
.lvl-pct { color: var(--muted); font-size: 13px; }
.lb-left, .lb-right { display: grid; gap: 16px; align-content: start; min-width: 0; }
.lb-board { padding: 20px; }
.lb-rows { list-style: none; display: grid; margin-top: 12px; }
.lb-rows li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.lb-rows li:last-child { border-bottom: 0; }
.lb-rows li.me { font-weight: 600; }
.lb-rows .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-rows .name:hover { color: var(--accent-text); }
.lb-rows .pts { color: var(--accent-text); font-weight: 600; }

/* ---------- anggota ---------- */
.members { padding-top: 16px; }
.members .tabs a { display: flex; align-items: center; justify-content: center; gap: 6px; }
.members .tabs .cnt { font-size: 13px; color: var(--faint); }
.members .tabs .cnt.hot { color: #fff; background: var(--accent); border-radius: 999px; padding: 0 7px; }
.member-search { margin: 18px 0 8px; }
.mlist { list-style: none; display: grid; }
.mrow { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 90px; }
.mrow-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.mbio { color: var(--muted); }
.mrow-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- notifikasi ---------- */
.nlist { list-style: none; display: grid; margin-top: 6px; }
.nrow { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.nrow-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 12px 10px; border-radius: 12px; }
.nrow-link:hover { background: var(--soft); }
.nrow.unread .nrow-link { background: var(--accent-soft); }
.nrow.unread .n-msg { font-weight: 500; }
.n-av { position: relative; flex: none; width: 42px; height: 42px; }
.n-ico-only { display: block; width: 42px; height: 42px; border-radius: 50%; background: var(--soft); }
.n-ico { position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; border: 2px solid #fff; }
.n-ico svg { width: 12px; height: 12px; }
.n-ico.t-like svg { fill: currentColor; }
.n-text { display: grid; gap: 2px; min-width: 0; }
.n-msg { font-size: 15px; line-height: 1.4; }

/* ---------- admin ---------- */
.admin-stats .stat small { display: block; margin-top: 2px; }
.rep { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.rep > .stack-sm { flex: 1; min-width: 240px; }
.rep-list, .cat-list, .audit-list { margin-top: 14px; list-style: none; }
.cat-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cat-edit, .cat-add { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; flex: 1; min-width: 260px; }
.cat-edit .input, .cat-add .input { height: 40px; flex: 1; min-width: 160px; max-width: 280px; }
.cat-add { margin-top: 16px; }
.cat-tools { justify-content: flex-end; }
.cat-tools .iconbtn { width: 34px; height: 34px; }
.cat-del .dd { width: 260px; }
.audit-list li { font-size: 14px; }
.audit-list .tag { margin-right: 6px; }

@media (max-width: 1180px) {
  .lb-top { grid-template-columns: 1fr; }
  /* satu kolom: urutan profil, 7 hari, 30 hari, sepanjang waktu, lalu tabel level */
  .lb-left, .lb-right { display: contents; }
  .lb-me { order: 1; } #papan-7 { order: 2; } #papan-30 { order: 3; } #papan-all { order: 4; } .lb-levels { order: 5; }
}
@media (max-width: 600px) {
  .prow.has-thumb { grid-template-columns: minmax(0, 1fr) 92px; gap: 14px; }
  .prow h3 { font-size: 16px; }
  .pin-tag .t { display: none; }
  .pin-tag { padding: 0 7px; }
  .contrib .small { display: none; }
  .composer > summary .btn { display: none; }
  .lb-me { flex-direction: column; align-items: flex-start; }
  .mrow { flex-wrap: wrap; }
  .mrow-actions { width: 100%; justify-content: flex-start; padding-left: 62px; }
  .hide-sm { display: none; }
  .cmt-new { flex-wrap: wrap; }
  .cmt-new > .av { display: none; }
  .replies { padding-left: 8px; }
  .rep-actions { width: 100%; }
}

/* halaman komunitas untuk tamu (layout public) */
.pub-comm { padding-top: 12px; }
.pub-comm-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.pub-comm .ctabs { margin: 0; padding: 0; }
.pub-comm-aside { position: sticky; top: 96px; display: grid; gap: 28px; padding: 22px 0 0; border: 0; height: auto; overflow: visible; }
@media (max-width: 900px) {
  .pub-comm-grid { grid-template-columns: minmax(0, 1fr); }
  .pub-comm-aside { position: static; }
}
