.community-page {
  --community-border: rgba(32, 42, 54, .12);
  --community-muted: #667085;
  background: var(--ar-body-bg, #fff);
  min-height: 70vh;
  padding: 6.25rem 0 5rem;
}

.community-shell {
  display: grid;
  grid-template-columns: minmax(0, 760px) 250px;
  gap: 3rem;
  justify-content: center;
}

.community-main,
.community-topic-shell,
.community-form-shell {
  min-width: 0;
}

.community-heading,
.community-back-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.community-heading h1,
.community-form-card h1,
.community-topic-header h1 {
  font-size: clamp(1.65rem, 4vw, 2.2rem);
  line-height: 1.2;
  margin: 0;
}

.community-unread-banner {
  align-items: center;
  background: rgba(var(--ar-primary-rgb, 68, 140, 116), .1);
  border-radius: 1rem;
  color: var(--ar-body-color, #17212b);
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 1rem 1.125rem;
  text-decoration: none;
}

.community-unread-banner strong { color: var(--ar-primary, #448c74); }

.community-tabs {
  border-bottom: 1px solid var(--community-border);
  display: flex;
  gap: 1.5rem;
  margin-bottom: .25rem;
  overflow-x: auto;
}

.community-tabs a {
  border-bottom: 2px solid transparent;
  color: var(--community-muted);
  flex: 0 0 auto;
  font-weight: 600;
  padding: .8rem 0;
  text-decoration: none;
}

.community-tabs a.is-active {
  border-bottom-color: var(--ar-primary, #448c74);
  color: var(--ar-primary, #448c74);
}

.community-tabs a span {
  background: var(--ar-primary, #448c74);
  border-radius: 99px;
  color: #fff;
  font-size: .7rem;
  margin-left: .2rem;
  padding: .08rem .35rem;
}

.community-feed-card { border-bottom: 1px solid var(--community-border); }
.community-feed-card__link { color: inherit; display: block; padding: 1.15rem .15rem; text-decoration: none; }
.community-feed-card__link:hover .community-feed-card__title { color: var(--ar-primary, #448c74); }
.community-feed-card__title { font-size: 1.05rem; line-height: 1.35; margin: 0 0 .38rem; transition: color .15s; }
.community-feed-card__category { color: var(--community-muted); font-size: .82rem; margin-bottom: .28rem; }
.community-feed-card__meta { align-items: center; color: var(--community-muted); display: flex; flex-wrap: wrap; font-size: .82rem; gap: .35rem; }
.community-feed-card__meta strong { color: var(--ar-primary, #448c74); }
.community-unread-dot { background: var(--ar-primary, #448c74); border-radius: 50%; display: inline-block; height: .5rem; margin: 0 .35rem .1rem 0; width: .5rem; }

.community-sidebar { padding-top: 4.8rem; }
.community-sidebar__card { border: 1px solid var(--community-border); border-radius: 1rem; margin-top: 1rem; padding: 1.2rem; }
.community-sidebar__card h2 { font-size: .95rem; margin-bottom: .8rem; }
.community-sidebar__card span { color: var(--community-muted); display: block; font-size: .9rem; padding: .35rem 0; }

.community-empty { padding: 3.5rem 1rem; text-align: center; }
.community-empty h2 { font-size: 1.2rem; }
.community-empty p { color: var(--community-muted); margin: .65rem auto 1.2rem; max-width: 430px; }

.community-fab {
  align-items: center;
  bottom: calc(1.25rem + env(safe-area-inset-bottom));
  box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .22);
  display: flex;
  font-size: 1.8rem;
  height: 3.5rem;
  justify-content: center;
  position: fixed;
  right: 1.25rem;
  width: 3.5rem;
  z-index: 1020;
  background: var(--ar-primary, #448c74);
  border-radius: 50%;
  color: #fff;
  text-decoration: none;
}

.community-form-shell,
.community-topic-shell { max-width: 780px; }
.community-back-header strong { font-size: 1rem; }
.community-back-header a,
.community-back-link { color: var(--community-muted); text-decoration: none; }
.community-form-card { border: 1px solid var(--community-border); border-radius: 1.1rem; padding: clamp(1.1rem, 4vw, 2rem); }
.community-form-card h1 { margin-bottom: 1.5rem; }
.community-form-card textarea { min-height: 180px; resize: vertical; }

.community-topic-header { border-bottom: 1px solid var(--community-border); margin-bottom: .5rem; padding-bottom: 1.5rem; }
.community-topic-header h1 { margin: 1.15rem 0 .6rem; overflow-wrap: anywhere; }
.community-topic-header__meta { color: var(--community-muted); display: flex; flex-wrap: wrap; font-size: .88rem; gap: .45rem; }
.community-status-badge { background: rgba(102, 112, 133, .12); border-radius: 99px; padding: .05rem .5rem; }

.community-message { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: .8rem; padding: 1.35rem 0; border-bottom: 1px solid var(--community-border); scroll-margin-top: 6rem; }
.community-avatar { align-items: center; background: rgba(var(--ar-primary-rgb, 68, 140, 116), .14); border-radius: 50%; color: var(--ar-primary, #448c74); display: flex; font-weight: 700; height: 42px; justify-content: center; overflow: hidden; width: 42px; }
.community-avatar img { height: 100%; object-fit: cover; width: 100%; }
.community-message__header { align-items: flex-start; display: flex; gap: 1rem; justify-content: space-between; }
.community-message__header strong { font-size: .95rem; }
.community-message__header time { color: var(--community-muted); flex: 0 0 auto; font-size: .75rem; }
.community-author-labels { display: flex; flex-wrap: wrap; gap: .3rem; min-height: .8rem; }
.community-author-labels span { color: var(--ar-primary, #448c74); font-size: .7rem; font-weight: 600; }
.community-message__body { font-size: .96rem; line-height: 1.6; margin-top: .75rem; overflow-wrap: anywhere; white-space: normal; }
.community-message__body blockquote { border-left: 3px solid var(--community-border); color: var(--community-muted); margin: .75rem 0; padding: .35rem 0 .35rem .85rem; }
.community-message__body blockquote > :last-child { margin-bottom: 0; }
.community-reply-context { background: rgba(102, 112, 133, .08); border-left: 3px solid var(--ar-primary, #448c74); border-radius: .35rem; color: inherit; display: block; font-size: .78rem; margin-top: .7rem; padding: .55rem .7rem; text-decoration: none; }
.community-reply-context strong,
.community-reply-context span { display: block; }
.community-reply-context span { color: var(--community-muted); margin-top: .12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.community-reply-context.is-unavailable { color: var(--community-muted); }
.community-message__actions { align-items: center; display: flex; gap: 1rem; margin-top: .8rem; }
.community-message__actions button { background: none; border: 0; color: var(--community-muted); font-size: .82rem; padding: 0; }
.community-message__actions button:hover { color: var(--ar-primary, #448c74); }
.community-reaction.is-active { color: #db4661; }
.community-reaction.is-readonly { color: var(--community-muted); font-size: .82rem; }
.community-delete-form { margin-left: auto; }
.community-delete-button { color: #b42318 !important; }

.community-unread-divider { align-items: center; color: var(--ar-primary, #448c74); display: flex; font-size: .78rem; font-weight: 700; gap: .75rem; padding-top: 1rem; }
.community-unread-divider::before,
.community-unread-divider::after { background: rgba(var(--ar-primary-rgb, 68, 140, 116), .35); content: ''; flex: 1; height: 1px; }

.community-composer { background: var(--ar-body-bg, #fff); bottom: 0; margin: 1.25rem 0 0; padding: .7rem 0 calc(.7rem + env(safe-area-inset-bottom)); position: sticky; z-index: 1010; }
.community-composer form { border: 1px solid var(--community-border); border-radius: .85rem; box-shadow: 0 -.25rem 1rem rgba(0, 0, 0, .04); padding: .55rem; }
.community-composer__row { align-items: flex-end; display: flex; gap: .5rem; }
.community-composer textarea { border: 0; box-shadow: none !important; max-height: 180px; min-height: 42px; resize: none; }
.community-composer__submit { align-items: center; border-radius: 50%; display: flex; flex: 0 0 42px; height: 42px; justify-content: center; padding: 0; }
.community-composer__reply { align-items: center; background: rgba(102, 112, 133, .08); border-radius: .55rem; display: flex; justify-content: space-between; margin-bottom: .35rem; padding: .45rem .6rem; }
.community-composer__reply[hidden] { display: none; }
.community-composer__reply strong,
.community-composer__reply span { display: block; font-size: .75rem; }
.community-composer__reply span { color: var(--community-muted); max-width: 65vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.community-composer__reply button { background: none; border: 0; font-size: 1.25rem; }
.community-closed-note { background: rgba(102, 112, 133, .08); border-radius: .75rem; color: var(--community-muted); margin-top: 1.5rem; padding: 1rem; text-align: center; }

.community-auth-prompt { background: var(--ar-body-bg, #fff); border: 1px solid var(--community-border); border-radius: 1rem; box-shadow: 0 .75rem 2rem rgba(0, 0, 0, .14); display: none; margin: 1rem 0; padding: 1.25rem; position: relative; }
.community-auth-prompt.is-visible { display: block; }
.community-auth-prompt strong,
.community-auth-prompt span { display: block; }
.community-auth-prompt span { color: var(--community-muted); font-size: .88rem; margin-top: .2rem; }
.community-auth-prompt__close { background: none; border: 0; font-size: 1.4rem; position: absolute; right: .75rem; top: .55rem; }

.community-pagination { justify-content: center; margin-top: 1.5rem; }
.community-pagination > li > a,
.community-pagination > li > span { border-radius: .5rem; display: block; margin: 0 .15rem; padding: .45rem .7rem; text-decoration: none; }
.community-pagination > .active > a,
.community-pagination > .active > span { background: var(--ar-primary, #448c74); color: #fff; }
.community-pagination > .disabled > span { color: var(--community-muted); opacity: .5; }

@media (max-width: 991.98px) {
  .community-shell { display: block; max-width: 780px; }
}

@media (max-width: 767.98px) {
  .community-page { padding: 5.25rem 0 4.5rem; }
  .community-heading { margin-bottom: 1rem; }
  .community-heading h1 { font-size: 1.75rem; }
  .community-unread-banner { align-items: flex-start; flex-direction: column; gap: .3rem; }
  .community-tabs { gap: 1.25rem; }
  .community-feed-card__link { padding: 1rem 0; }
  .community-form-card { border: 0; padding: .4rem 0; }
  .community-back-header { margin-bottom: 1rem; }
  .community-topic-header { padding-bottom: 1.1rem; }
  .community-message { grid-template-columns: 36px minmax(0, 1fr); gap: .65rem; }
  .community-avatar { height: 36px; width: 36px; }
  .community-message__header time { max-width: 75px; text-align: right; }
}

/* Inline message editing */
.community-message__actions {
    flex-wrap: wrap;
}

.community-edit-form {
    flex: 0 0 100%;
    width: 100%;
}

.community-edit-form textarea {
    width: 100%;
}
