.chat-tabs { display: flex; gap: 4px; padding: 0 8px 8px; }
.chat-tabs .tab {
  flex: 1;
  background: #fff;
  border: 1px solid var(--grey-300);
  padding: 9px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  position: relative;
}
.chat-tabs .tab.active { background: var(--scvfs-black); color: #fff; border-color: var(--scvfs-black); }
.chat-tabs .tab:hover:not(.active) { background: var(--grey-100); }
.unread-badge { background: var(--scvfs-red); color: #fff; padding: 2px 6px; border-radius: 99px; font-size: 11px; font-weight: 800; margin-left: 4px; }

.chat-poster-card { border-top: 3px solid var(--scvfs-red); }
.chat-author { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.chat-author strong { color: var(--ink); }
.admin-pill { background: var(--scvfs-red); color: #fff; padding: 2px 6px; border-radius: 3px; font-size: 9px; font-weight: 800; letter-spacing: 1px; margin-left: 6px; vertical-align: 1px; }
.admin-pill.small { font-size: 8px; padding: 1px 4px; }

#chat-input, .reply-form textarea, .modal textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--grey-300);
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.poster-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.poster-row .primary { margin-left: auto; }

.attach-btn {
  background: var(--grey-100);
  color: var(--ink);
  padding: 7px 11px;
  border-radius: 5px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--grey-300);
}
.attach-btn:hover { background: var(--grey-300); }

.attach-preview { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--scvfs-light);
  color: var(--scvfs-blue-dark, #1d4f74);
  padding: 4px 8px;
  border-radius: 99px;
  font-size: 12px;
}
.attach-remove { background: transparent; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 0 0 0 4px; line-height: 1; }

.important-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--scvfs-red-tint);
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
}
.important-toggle input { width: auto; margin: 0; }

.chat-stream-card h3 { color: var(--scvfs-red); margin-top: 0; }

.chat-msg {
  border-top: 1px solid var(--grey-100);
  padding: 10px 0;
}
.chat-msg:first-child { border-top: none; padding-top: 0; }
.chat-msg.is-reply {
  border-top: none;
  margin-left: 24px;
  padding-left: 12px;
  border-left: 3px solid var(--grey-300);
  padding-top: 8px;
  padding-bottom: 8px;
}
.chat-msg.important {
  background: linear-gradient(to right, var(--scvfs-red-tint), transparent);
  margin: 0 -8px;
  padding-left: 10px;
  padding-right: 10px;
  border-radius: 6px;
}
.chat-msg.mine { background: #f5f8fa; padding-left: 10px; padding-right: 10px; border-radius: 6px; margin: 0 -8px; }

.msg-badge {
  display: inline-block;
  background: var(--scvfs-red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 2px 7px;
  border-radius: 3px;
  margin-bottom: 6px;
}
.msg-head { font-size: 13px; margin-bottom: 4px; }
.msg-head .small { margin-left: 8px; }
.msg-text { font-size: 14px; line-height: 1.5; color: var(--ink); }
.msg-text.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 9em;
}
.view-full-btn {
  background: transparent;
  border: none;
  color: var(--scvfs-red);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
  margin-top: 2px;
  font-family: inherit;
}
.view-full-btn:hover { text-decoration: underline; }

.msg-topic-tag {
  display: inline-block;
  background: #fff3d6;
  color: #7a4a00;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
}

#topic-label {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--grey-300);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  margin-bottom: 8px;
  box-sizing: border-box;
  background: #fff8e7;
}
#topic-label:focus { outline: none; border-color: var(--scvfs-red); }

.topic-search-card { border-left: 4px solid #e9b949; }
.topic-search-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.topic-search-head strong { color: var(--scvfs-red); font-size: 14px; }
#topic-search {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--grey-300);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
.topic-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.topic-pill {
  background: #fff3d6;
  color: #7a4a00;
  border: 1px solid #e9b949;
  padding: 5px 11px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.topic-pill:hover { background: #ffe8a8; }
.topic-pill span {
  background: #e9b949;
  color: #fff;
  padding: 1px 6px;
  border-radius: 99px;
  font-size: 10px;
  margin-left: 2px;
}

/* Pinned post styling */
.pinned-card { background: #fffbe6; border: 2px solid #e9b949; }
.pinned-head {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #7a4a00;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.chat-msg.is-pinned { position: relative; }
.unpin-btn {
  position: absolute;
  top: 6px;
  right: 0;
  background: transparent;
  border: 1px solid #e9b949;
  color: #7a4a00;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}
.unpin-btn:hover { background: #fff3d6; }
.pin-toggle { background: #fff3d6 !important; }
.rsvp-toggle { background: #e0e7ff !important; }

/* RSVP buttons */
.rsvp-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 8px;
  background: #f0f4ff;
  border-radius: 6px;
  border-left: 3px solid #2b6f9c;
}
.rsvp-label { font-size: 12px; font-weight: 700; color: #1d4f74; margin-right: 4px; }
.rsvp-btn {
  background: #fff;
  border: 1.5px solid var(--grey-300);
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.rsvp-btn:hover { background: var(--grey-100); }
.rsvp-btn.on.yes { background: #d8e7d8; border-color: #1f5025; color: #1f5025; }
.rsvp-btn.on.no { background: var(--scvfs-red-tint); border-color: var(--scvfs-red); color: var(--scvfs-red-dark); }
.rsvp-btn.on.maybe { background: #fff3d6; border-color: #e9b949; color: #7a4a00; }
.rsvp-btn span {
  background: rgba(0,0,0,0.1);
  padding: 1px 5px;
  border-radius: 99px;
  font-size: 10px;
  margin-left: 2px;
}

.msg-seen { margin-top: 6px; font-size: 11px; }

/* Day separator */
.day-sep {
  display: flex;
  align-items: center;
  margin: 16px 0 8px;
  text-align: center;
}
.day-sep::before, .day-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--grey-300);
}
.day-sep span {
  padding: 0 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

/* Photo carousel for 3+ images */
.msg-carousel {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin: 8px -8px 0;
  padding: 0 8px 8px;
  -webkit-overflow-scrolling: touch;
}
.msg-carousel::-webkit-scrollbar { height: 4px; }
.carousel-item {
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: block;
}
.carousel-item img {
  height: 200px;
  width: auto;
  border-radius: 6px;
  display: block;
  cursor: zoom-in;
}

.chat-msg.flash {
  animation: msgFlash 2.2s ease-out;
}
@keyframes msgFlash {
  0%, 30% { background: #fff3d6; box-shadow: 0 0 0 4px #e9b949; }
  100% { }
}

.msg-attach { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.msg-attach img { max-width: 240px; max-height: 240px; border-radius: 6px; cursor: zoom-in; display: block; }
.pdf-link {
  display: inline-block;
  background: var(--grey-100);
  color: var(--scvfs-red-dark);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.pdf-link:hover { background: var(--scvfs-red-tint); }

.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.rxn {
  background: var(--grey-100);
  border: 1px solid transparent;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s ease;
}
.rxn:hover { background: var(--grey-300); }
.rxn.on { background: var(--scvfs-red-tint); border-color: var(--scvfs-red); }
.rxn span { font-size: 11px; font-weight: 700; color: var(--scvfs-red-dark); margin-left: 2px; }

.msg-actions { margin-top: 6px; display: flex; gap: 12px; flex-wrap: wrap; }
.link-btn {
  background: transparent;
  border: none;
  color: var(--scvfs-red);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.link-btn:hover { text-decoration: underline; }

.reply-form-mount { margin-top: 8px; }
.reply-form {
  background: var(--grey-50);
  padding: 10px;
  border-radius: 6px;
  margin-top: 6px;
}
.reply-form .poster-row .primary { background: var(--scvfs-red); color: #fff; }

.replies { margin-top: 6px; }

/* Inbox */
.inbox-thread {
  border: 1px solid var(--grey-100);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}
.inbox-head { margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--grey-100); }
.inbox-head .small { margin-left: 8px; }
.thread-reply-mount { margin-top: 8px; }
.inbox-reply-btn { margin-top: 6px; }
