/* Phase 4: Class Wall, comments, polls, chat, forum, groups, notifications, moderation, suggestions. */
.feed-context { margin: 0 0 var(--sp-3); font-size: var(--fs-sm); }
.feed-layout { align-items: start; }
.feed-side { position: sticky; top: calc(var(--m-top, 60px) + var(--sp-4)); }
@media (max-width: 899px) { .feed-side { position: static; order: -1; } .feed-side > .card:not(.prompt-card) { display: none; } }
.prompt-card { background: linear-gradient(160deg, var(--navy-700), var(--navy-950)); color: #d7deea; border: 0; }
.prompt-card h2 { color: var(--ivory-50); font-size: var(--fs-xl); margin-bottom: var(--sp-2); }
.prompt-card .eyebrow { color: var(--gold-300); }

/* ---------- Composer ---------- */
.composer { margin-bottom: var(--sp-4); padding: var(--sp-4); }
.composer__top { display: flex; gap: var(--sp-3); align-items: flex-start; }
.composer__field { flex: 1; min-width: 0; }
.composer textarea { min-height: 56px; resize: vertical; }
.composer__media { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.thumb { position: relative; width: 84px; height: 84px; border-radius: var(--radius-sm); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 2px; right: 2px; width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgb(0 0 0 / 0.6); color: #fff; }
.thumb .icon { width: 14px; height: 14px; }
.composer__poll { border: 1px dashed var(--color-border-strong); border-radius: var(--radius); padding: var(--sp-3); margin: var(--sp-3) 0 0; }
.composer__poll .field { margin-bottom: var(--sp-2); }
.composer__row { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); align-items: center; }
.composer__bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1); margin-top: var(--sp-3); padding-top: var(--sp-2); border-top: 1px solid var(--color-border); }
.composer__announce { min-height: 36px; font-size: var(--fs-sm); margin-left: var(--sp-2); }
.composer__send { margin-left: auto; }
.new-posts { position: sticky; top: calc(var(--m-top, 60px) + 8px); z-index: 3; display: flex; margin: 0 auto var(--sp-3); box-shadow: var(--shadow-lg); }

/* ---------- Posts ---------- */
.posts { display: grid; gap: var(--sp-4); }
.post { padding: var(--sp-4); overflow: visible; }
.post--announce { border-left: 4px solid var(--color-accent); }
.post__head { display: flex; align-items: center; gap: var(--sp-3); position: relative; }
.post__who { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.post__who a { color: inherit; text-decoration: none; }
.post__who a:hover { text-decoration: underline; }
.post__meta { font-size: var(--fs-xs); color: var(--color-text-muted); }
.post__meta a { color: inherit; }
.post__badges { display: flex; flex-wrap: wrap; gap: var(--sp-1); justify-content: flex-end; }
.post__badges .icon { width: 12px; height: 12px; }
.post__menu { position: relative; }
.post__menu summary { list-style: none; cursor: pointer; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; font-size: 20px; color: var(--color-text-muted); }
.post__menu summary::-webkit-details-marker { display: none; }
.post__menu summary:hover { background: var(--color-bg-alt); }
.post__menu > div { position: absolute; right: 0; top: 100%; z-index: 5; min-width: 170px; display: grid; padding: var(--sp-1); background: var(--color-surface-raised); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.post__menu button { text-align: left; border: 0; background: none; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); font-size: var(--fs-sm); color: var(--color-text); }
.post__menu button:hover { background: var(--color-bg-alt); }
.post__body { margin: var(--sp-3) 0; overflow-wrap: anywhere; }
.post__body a, .cmt__bubble a:not(:first-child) { color: var(--color-link); }
.tag { color: var(--color-accent-text) !important; font-weight: 600; text-decoration: none; }
.mention { color: var(--color-heading); }
.post__media { display: grid; gap: 4px; border-radius: var(--radius); overflow: hidden; margin: var(--sp-3) 0; }
.post__media--2, .post__media--4 { grid-template-columns: 1fr 1fr; }
.post__media--3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.post__media--3 button:first-child { grid-row: span 2; }
.post__media button { border: 0; padding: 0; background: var(--color-bg-alt); aspect-ratio: 4 / 3; cursor: zoom-in; }
.post__media--1 button { aspect-ratio: auto; max-height: 520px; }
.post__media img { width: 100%; height: 100%; object-fit: cover; }
.lightbox-img { max-height: 70vh; width: auto; margin: 0 auto; border-radius: var(--radius-sm); }
.post__stats { display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-sm); color: var(--color-text-muted); min-height: 24px; }
.post__actions { display: flex; gap: var(--sp-1); border-top: 1px solid var(--color-border); margin-top: var(--sp-2); padding-top: var(--sp-1); }
.post__actions > * { flex: 1; }
.post__actions .btn { width: 100%; }
.react { position: relative; }
.react .is-on { color: var(--color-accent-text); }
.react__pick { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 6; display: flex; max-width: calc(100vw - 2 * var(--gutter, 1rem)); overflow-x: auto; gap: 2px; padding: 6px; background: var(--color-surface-raised); border: 1px solid var(--color-border); border-radius: var(--radius-full); box-shadow: var(--shadow-lg); }
.react__pick button { border: 0; background: none; font-size: 24px; width: 44px; height: 44px; border-radius: 50%; transition: transform var(--dur-fast) var(--ease); }
.react__pick button:hover, .react__pick button:focus-visible { transform: scale(1.25); background: var(--color-bg-alt); }

/* ---------- Polls ---------- */
.poll { display: grid; gap: var(--sp-2); margin: var(--sp-3) 0; padding: var(--sp-3); border-radius: var(--radius); background: var(--color-bg-alt); }
.poll__q { margin: 0; font-weight: 700; }
.poll__opt { min-height: 40px; padding: 0 var(--sp-3); border-radius: var(--radius-sm); background: var(--color-surface); border: 1px solid var(--color-border); }
.poll .btn { justify-self: start; }
.poll__bar { position: relative; display: flex; justify-content: space-between; align-items: center; min-height: 40px; padding: 0 var(--sp-3); border-radius: var(--radius-sm); background: var(--color-surface); overflow: hidden; border: 1px solid var(--color-border); }
.poll__fill { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--color-accent) 30%, transparent); transition: width 0.8s var(--ease); }
.poll__bar.is-mine { border-color: var(--color-accent); }
.poll__label, .poll__pct { position: relative; font-size: var(--fs-sm); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.poll__label .icon { width: 14px; height: 14px; color: var(--color-success); }
.poll p { margin: 0; }

/* ---------- Comments ---------- */
.comments { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--color-border); display: grid; gap: var(--sp-3); }
.cmt { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--sp-2); }
.cmt--reply { margin-left: var(--sp-6); margin-top: var(--sp-2); }
.cmt > .cmt { grid-column: 1 / -1; }
.cmt__bubble { background: var(--color-bg-alt); border-radius: 14px; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.cmt__bubble > a:first-child { color: inherit; text-decoration: none; }
.cmt__meta { grid-column: 2; display: flex; gap: var(--sp-3); font-size: var(--fs-xs); color: var(--color-text-muted); padding-left: var(--sp-2); }
.cmt-form { display: flex; gap: var(--sp-2); align-items: flex-end; }
.cmt-form__field { flex: 1; }
.cmt-form textarea { min-height: 44px; }

/* ---------- Mentions dropdown ---------- */
.mention-host { position: relative; }
.mention-box { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; margin-top: 4px; max-height: 260px; overflow-y: auto; background: var(--color-surface-raised); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.mention-box button { display: flex; align-items: center; gap: var(--sp-2); width: 100%; padding: var(--sp-2) var(--sp-3); border: 0; background: none; text-align: left; color: var(--color-text); font-size: var(--fs-sm); }
.mention-box button[aria-selected='true'], .mention-box button:hover { background: var(--color-info-bg); }

/* ---------- Groups ---------- */
.groups-section { margin-bottom: var(--sp-6); }
.groups-grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.group-card { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4); }
.group-card__icon { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: var(--radius); background: var(--color-info-bg); color: var(--color-accent-text); }
.group-card__body { flex: 1; min-width: 0; }
.group-card__body h3 { font-size: var(--fs-lg); margin: 0 0 var(--sp-1); font-family: var(--font-body); }
.group-card__body h3 a { color: var(--color-heading); text-decoration: none; }
.group-card__body p { margin: 0 0 var(--sp-1); }
.group-card__body .icon { width: 12px; height: 12px; vertical-align: -1px; }

/* ---------- Chat ---------- */
.m-main--chat { padding-bottom: calc(var(--m-bottom) + var(--sp-2)); }
.chat { display: grid; height: calc(100dvh - var(--m-top) - var(--m-bottom) - var(--sp-7)); min-height: 420px; border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; background: var(--color-surface); }
.chat__list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--color-border); }
.chat__list-head { display: flex; gap: var(--sp-1); align-items: center; padding: var(--sp-3); border-bottom: 1px solid var(--color-border); }
.chat__list-head .input { flex: 1; min-width: 0; }
.chat__convs { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.chat__none { padding: var(--sp-4); }
.conv { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3); text-decoration: none; color: inherit; border-bottom: 1px solid var(--color-border); }
.conv:hover { background: var(--color-bg-alt); }
.conv.is-active { background: var(--color-info-bg); }
.conv__text { flex: 1; min-width: 0; display: grid; }
.conv__text small { color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.is-unread .conv__text strong, .conv.is-unread .conv__text small { color: var(--color-text); font-weight: 700; }
.conv__meta { display: grid; justify-items: end; gap: 4px; font-size: var(--fs-xs); color: var(--color-text-muted); }
.count-dot { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-full); background: var(--color-accent); color: var(--color-on-accent); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.chat__group-ic .icon { width: 18px; height: 18px; }
.chat__main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat__empty { margin: auto; border: 0; }
.chat__head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--color-border); }
.chat__title { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.chat__title small { color: var(--color-text-muted); font-size: var(--fs-xs); }
.chat__title small.is-typing { color: var(--color-success); font-style: italic; }
.chat__msgs { flex: 1; overflow-y: auto; padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); background: var(--color-bg); }
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 78%; }
.msg--mine { align-self: flex-end; align-items: flex-end; }
.msg__name { font-size: var(--fs-xs); font-weight: 700; color: var(--color-accent-text); margin: var(--sp-2) 0 2px var(--sp-2); }
.msg__bubble { padding: var(--sp-2) var(--sp-3); border-radius: 18px 18px 18px 4px; background: var(--color-surface); border: 1px solid var(--color-border); overflow-wrap: anywhere; font-size: var(--fs-sm); }
.msg--mine .msg__bubble { background: var(--color-primary); color: var(--color-on-primary); border-color: transparent; border-radius: 18px 18px 4px 18px; }
.msg--mine .msg__bubble a { color: inherit; text-decoration: underline; }
.msg__meta { display: flex; gap: var(--sp-2); font-size: 11px; color: var(--color-text-muted); padding: 2px var(--sp-2); }
.msg__meta .link-btn { font-size: 11px; opacity: 0; }
.msg:hover .msg__meta .link-btn, .msg:focus-within .msg__meta .link-btn { opacity: 1; }
.msg__img { border: 0; padding: 0; background: none; display: block; max-width: 260px; border-radius: 12px; overflow: hidden; margin-bottom: 4px; cursor: zoom-in; }
.msg__file { display: inline-flex; align-items: center; gap: var(--sp-1); font-weight: 600; }
.seen { align-self: flex-end; font-size: 11px; color: var(--color-text-muted); margin: 0; display: inline-flex; align-items: center; gap: 2px; }
.seen .icon { width: 12px; height: 12px; color: var(--color-success); }
.chat__form { display: flex; gap: var(--sp-2); align-items: flex-end; padding: var(--sp-2) var(--sp-3); border-top: 1px solid var(--color-border); flex-wrap: wrap; }
.chat__form textarea { flex: 1; min-height: 44px; max-height: 140px; min-width: 0; }
.chat__form label.icon-btn { cursor: pointer; }
.chat__file-name { flex-basis: 100%; order: -1; color: var(--color-text-muted); }
.chat__file-name:empty { display: none; }
.chat__back { display: none; }
@media (min-width: 900px) { .chat { grid-template-columns: 320px 1fr; } }
@media (max-width: 899px) {
  .chat__main { display: none; }
  .chat.is-open .chat__list { display: none; }
  .chat.is-open .chat__main { display: flex; }
  .chat__back { display: grid; }
  .msg { max-width: 88%; }
}

/* ---------- Forum ---------- */
.forum { display: grid; gap: var(--sp-4); }
.forum__cats { display: flex; gap: var(--sp-1); overflow-x: auto; padding: var(--sp-2); }
.forum__cat { display: flex; align-items: center; gap: var(--sp-2); white-space: nowrap; border: 0; background: none; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); color: var(--color-text); font-size: var(--fs-sm); text-align: left; }
.forum__cat:hover { background: var(--color-bg-alt); }
.forum__cat.is-active { background: var(--color-info-bg); font-weight: 700; color: var(--color-heading); }
.forum__cat .icon { color: var(--color-accent-text); width: 18px; height: 18px; }
@media (min-width: 1024px) { .forum { grid-template-columns: 240px 1fr; align-items: start; } .forum__cats { flex-direction: column; overflow: visible; position: sticky; top: calc(var(--m-top) + var(--sp-4)); } }
.threads { list-style: none; margin: 0; padding: 0; }
.thread-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--color-border); }
.thread-row:last-child { border-bottom: 0; }
.thread-row__main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.thread-row__main a { color: var(--color-heading); text-decoration: none; }
.thread-row__main a:hover { text-decoration: underline; }
.thread-row__tags { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.thread-row__tags .icon { width: 12px; height: 12px; }
.thread-row__stats { display: grid; justify-items: end; font-size: var(--fs-xs); color: var(--color-text-muted); gap: 2px; }
.thread-row__stats .icon { width: 12px; height: 12px; vertical-align: -1px; }
.forum-post { padding: var(--sp-5); }
.forum-post__title { font-size: var(--fs-2xl); margin: var(--sp-4) 0 var(--sp-2); }
.forum-post__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.replies { display: grid; gap: var(--sp-3); }
.reply { padding: var(--sp-4); }
.reply--best { border: 2px solid var(--color-success); }
.vote { min-height: 34px; padding: 0 var(--sp-3); border-radius: var(--radius-full); border: 1px solid var(--color-border-strong); background: var(--color-surface); font-weight: 700; font-size: var(--fs-sm); color: var(--color-text); }
.vote.is-on { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.vote:disabled { opacity: 0.6; cursor: default; }
.reply-form { margin-top: var(--sp-4); }
.reply-form label { font-weight: 600; display: block; margin-bottom: var(--sp-2); }

/* ---------- Notifications ---------- */
.notif-prefs td:not(:first-child), .notif-prefs th:not(:first-child) { text-align: center; width: 110px; }
.notif-prefs .check { justify-content: center; min-height: 32px; }

/* ---------- Moderation & suggestions ---------- */
.mod-list, .sugg-list { list-style: none; margin: 0; padding: 0; }
.mod-item { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4); border-bottom: 1px solid var(--color-border); }
.mod-item > div:first-child { flex: 1; min-width: 240px; }
.mod-item p { margin: var(--sp-2) 0; overflow-wrap: anywhere; }
.mod-item .btn-row { margin: 0; align-self: center; }
.sugg-list li { padding: var(--sp-3) 0; border-bottom: 1px solid var(--color-border); }
.sugg-list.card li { padding: var(--sp-4); }
.sugg-list li:last-child { border-bottom: 0; }
.sugg-list p { margin: 0 0 var(--sp-1); }
.sugg-answer { margin-top: var(--sp-2) !important; padding: var(--sp-2) var(--sp-3); border-left: 3px solid var(--color-accent); background: var(--color-bg-alt); }
.lead { font-size: var(--fs-lg); color: var(--color-text-muted); }
