.topic-composer {
  display: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  margin: 0 0 20px;
  box-shadow: 0 5px 18px rgba(0,0,0,.05);
}

.topic-composer.is-open {
  display: block;
}

.topic-composer-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.topic-composer-header h2 {
  margin: .15rem 0 .35rem;
  font-size: 1.5rem;
}

.topic-composer-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.composer-close {
  border: 0;
  background: transparent;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.composer-field {
  margin: 0 0 17px;
}

.composer-field label {
  margin: 0 0 7px;
}

.composer-field select,.composer-field textarea,.composer-field input {
  width: 100%;
  border: 1px solid #bdc8d0;
  border-radius: 7px;
  padding: 11px;
  font: inherit;
  background: #fff;
}

.composer-field textarea {
  resize: vertical;
  min-height: 230px;
  line-height: 1.5;
}

.composer-field small {
  display: block;
  color: var(--muted);
  margin-top: 6px;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  background: #eef2f5;
  border: 1px solid #ccd6dd;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  padding: 8px;
}

.editor-toolbar button,.toolbar-size-label {
  border: 1px solid #c2ccd3;
  background: #fff;
  border-radius: 5px;
  padding: 6px 9px;
  font: inherit;
  cursor: pointer;
}

.toolbar-size-label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: .85rem;
  font-weight: 700;
}

.toolbar-size-label select {
  border: 0;
  padding: 0;
  width: auto;
}

#topic-body {
  border-radius: 0 0 7px 7px;
}

.composer-actions,.preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.composer-error {
  background: #ffe8ea;
  color: #8e1722;
  padding: 11px 13px;
  border-radius: 7px;
  margin-bottom: 16px;
  font-weight: 700;
}

.composer-context-box {
  background: #f3f6f8;
  border-left: 4px solid var(--red);
  padding: 11px 13px;
  border-radius: 5px;
  margin: -5px 0 18px;
}

.composer-context-box strong,.composer-context-box span {
  display: block;
}

.composer-context-box span {
  color: var(--muted);
  margin-top: 4px;
}

.topic-preview {
  border-top: 4px solid var(--red);
  margin-top: 25px;
  padding-top: 18px;
}

.preview-label {
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .08em;
  color: var(--red);
  margin-bottom: 10px;
}

.forum-post-preview {
  display: grid;
  grid-template-columns: 170px minmax(0,1fr);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  margin-bottom: 14px;
}

.post-author-card {
  background: #edf2f5;
  padding: 18px;
  text-align: center;
  border-right: 1px solid var(--line);
}

.post-author-card strong,.post-author-card span,.post-author-card small {
  display: block;
}

.post-author-card span,.post-author-card small {
  color: var(--muted);
  margin-top: 4px;
}

.initial-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  margin: 0 auto 10px;
  font-size: 1.5rem;
  font-weight: 900;
}

.post-content-card {
  min-width: 0;
}

.post-content-card header {
  padding: 13px 17px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 15px;
}

.post-content-card header h2 {
  font-size: 1rem;
  margin: 0;
}

.post-content-card header span {
  color: var(--muted);
  font-size: .8rem;
}

.post-body {
  padding: 20px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.post-body a {
  color: #12619a;
}

.topic-title-link {
  text-decoration: none;
}

.topic-title-link:hover {
  color: var(--red);
}

.topic-page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 20px;
}

.topic-page-heading h1 {
  margin: .12rem 0 .28rem;
  font-size: clamp(1.30rem,1.6vw,1.45rem);
  line-height: 1.10;
}

.topic-live-post {
  margin-top: 0;
}

@media (max-width:700px) {
  .topic-page-heading h1 {
    font-size: 1.25rem;
    line-height: 1.10;
  }

  .forum-post-preview {
    grid-template-columns: 1fr;
  }

  .post-author-card {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    text-align: left;
  }

  .initial-avatar {
    margin: 0 10px 0 0;
    display: inline-grid;
    vertical-align: middle;
    width: 48px;
    height: 48px;
  }

  .post-author-card strong {
    display: inline;
  }

  .composer-actions,.preview-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .composer-actions .btn,.preview-actions .btn {
    width: 100%;
  }
}

/* Milestone 2C — topic conversations and replies */

.topic-conversation {
  margin-bottom: 22px;
}

.topic-conversation .topic-live-post {
  margin-bottom: 16px;
}

.topic-reply {
  scroll-margin-top: 18px;
}

.reply-composer-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 5px 18px rgba(0,0,0,.05);
}

.reply-composer-heading {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.reply-composer-heading h2 {
  margin: .15rem 0 0;
  font-size: 1.45rem;
}

.reply-composer-card textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid #bdc8d0;
  border-radius: 7px;
  padding: 12px;
  font: inherit;
  line-height: 1.5;
}

.reply-login-prompt,.reply-locked {
  background: #f3f6f8;
  border-left: 4px solid var(--red);
  padding: 16px;
  border-radius: 6px;
}

.reply-login-prompt p {
  margin: 0 0 12px;
}

.reply-locked {
  color: var(--muted);
}

/* Milestone 2C refinement — collapsed reply composer + formatting ribbon */


.reply-open-button {
  min-width: 96px;
}

.reply-composer-card {
  display: none;
}

.reply-composer-card.is-open {
  display: block;
}


.reply-composer-card .editor-toolbar {
  border-radius: 7px 7px 0 0;
}

.reply-composer-card #reply-body {
  border-radius: 0 0 7px 7px;
  margin: 0;
}

.reply-editor-toolbar button {
  min-width: 34px;
}

.reply-editor-toolbar .toolbar-size-label select {
  width: auto;
}

@media (max-width:700px) {
  .reply-open-button {
    width: 100%;
  }

  .reply-editor-toolbar {
    gap: 6px;
  }

  .reply-editor-toolbar button {
    min-width: 36px;
  }
}

/* Milestone 2C — topic pagination */

.topic-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--line);
  margin: 0 0 16px;
}

.topic-conversation .topic-pagination:last-child {
  margin: 0;
}

.pagination-summary {
  color: var(--muted);
  font-weight: 800;
}

.pagination-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.pagination-links a,
.pagination-links .current-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd5dc;
  text-decoration: none;
  font-weight: 800;
  background: #fff;
}

.pagination-links a:hover {
  border-color: var(--red);
  color: var(--red);
}

.pagination-links .current-page {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}


.pagination-gap {
  padding: 0 3px;
  color: var(--muted);
}

@media (max-width:700px) {
  .topic-pagination {
    align-items: flex-start;
    flex-direction: column;
  }

  .pagination-links {
    width: 100%;
  }


}

/* Milestone 2C refinement — separate the listing/topic from its conversation */

.conversation-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid var(--navy);
}

.conversation-heading-row h2 {
  margin: 2px 0 0;
}

.conversation-heading-row>span {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
  padding-bottom: 2px;
}

@media (max-width:700px) {
  .conversation-heading-row {
    align-items: flex-start;
  }
}

/* Milestone 2C — compact density pass
   Preserve the existing visual language while reclaiming screen space. */

.topic-conversation {
  --post-author-width: 138px;
}

/* Posts: less surrounding chrome, same readable body text. */

.topic-live-post {
  margin-bottom: 10px;
}

.topic-live-post .post-author-card {
  flex: 0 0 var(--post-author-width);
  width: var(--post-author-width);
  padding: 12px 10px;
  gap: 4px;
}

.topic-live-post .post-author-card .initial-avatar {
  width: 42px;
  height: 42px;
  font-size: 1rem;
  margin-bottom: 3px;
}

.topic-live-post .post-author-card strong {
  font-size: .92rem;
  line-height: 1.15;
}

.topic-live-post .post-author-card .member-rank,
.topic-live-post .post-author-card .member-role,
.topic-live-post .post-author-card .member-badge {
  font-size: .68rem;
  line-height: 1.15;
}

.topic-live-post .post-author-card small {
  font-size: .72rem;
  margin-top: 2px;
}

.topic-live-post .post-content-card {
  min-height: 0;
}

.topic-live-post .post-content-card header {
  min-height: 34px;
  padding: 7px 12px;
  font-size: .76rem;
}

.topic-live-post .post-body {
  padding: 13px 14px 15px;
  line-height: 1.48;
}

/* Recruitment ad: tighten the gaps without changing its hierarchy. */

.recruitment-ad-body .topic-live-post {
  margin-bottom: 0;
}

.recruitment-owner-actions {
  padding-top: 12px;
  padding-bottom: 12px;
}

.recruitment-summary-grid {
  gap: 8px 12px;
}

.recruitment-summary-item {
  padding-top: 7px;
  padding-bottom: 7px;
}

/* Conversation heading: clear divider, less vertical footprint. */

.conversation-heading-row {
  margin: 17px 0 8px;
  padding-bottom: 6px;
}

.conversation-heading-row h2 {
  font-size: 1.2rem;
  line-height: 1.15;
}

.conversation-heading-row .eyebrow {
  margin-bottom: 1px;
}

/* Pagination: compact strip rather than a second row of large controls. */

.topic-pagination {
  gap: 9px;
  padding: 7px 9px;
  margin-bottom: 10px;
  border-radius: 7px;
}

.pagination-summary {
  font-size: .75rem;
}

.pagination-links {
  gap: 3px;
}

.pagination-links a,
.pagination-links .current-page {
  min-width: 29px;
  height: 29px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: .78rem;
}

.pagination-links .pagination-step {
  min-width: auto;
  padding-left: 9px;
  padding-right: 9px;
}

/* Reply area/composer spacing. */

.reply-area {
  margin-top: 15px;
}

.reply-composer-card {
  margin-top: 9px;
}

.reply-composer-card .composer-field {
  margin-bottom: 12px;
}

.reply-composer-card #reply-body {
  min-height: 145px;
}

/* Keep mobile touchability while reducing wasted vertical whitespace. */

@media (max-width:700px) {
  .topic-live-post {
    margin-bottom: 9px;
  }

  .topic-live-post .post-author-card {
    width: 100%;
    padding: 9px 11px;
    gap: 3px 7px;
  }

  .topic-live-post .post-author-card .initial-avatar {
    width: 38px;
    height: 38px;
  }

  .topic-live-post .post-content-card header {
    padding: 6px 10px;
  }

  .topic-live-post .post-body {
    padding: 11px 12px 13px;
    line-height: 1.46;
  }

  .conversation-heading-row {
    margin-top: 14px;
  }

  .topic-pagination {
    gap: 6px;
    padding: 7px;
  }

  .pagination-links {
    gap: 3px;
  }

  .pagination-links a,
  .pagination-links .current-page {
    min-width: 32px;
    height: 32px;
    padding: 0 7px;
  }

  .reply-area {
    margin-top: 12px;
  }
}

/* Milestone 2C — first-unread navigation */

.conversation-heading-meta {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 3px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
}

.first-unread-link {
  color: var(--red);
  text-decoration: none;
  font-size: .76rem;
  font-weight: 900;
}

.first-unread-link:hover {
  text-decoration: underline;
}

@media (max-width:700px) {
  .conversation-heading-meta {
    align-items: flex-start;
  }
}

/* Milestone 2C — quote/reply-to-post */

.post-meta-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.post-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-quote-button {
  appearance: none;
  border: 1px solid #cbd5dc;
  border-radius: 5px;
  background: #fff;
  color: var(--navy-2);
  padding: 3px 7px;
  font: inherit;
  font-size: .72rem;
  font-weight: 900;
  line-height: 1.2;
  cursor: pointer;
}

.post-quote-button:hover {
  border-color: var(--red);
  color: var(--red);
}

.forum-quote {
  margin: 4px 0 12px;
  padding: 0;
  border: 1px solid #ccd6dd;
  border-left: 3px solid var(--red);
  border-radius: 6px;
  background: #f5f7f8;
  overflow: hidden;
}

.forum-quote-author {
  padding: 6px 9px;
  border-bottom: 1px solid #d8e0e6;
  background: #e9eef2;
  color: var(--navy-2);
  font-size: .75rem;
  font-weight: 900;
}

.forum-quote-body {
  padding: 8px 10px;
  color: #34434f;
  font-size: .92em;
  line-height: 1.42;
}

@media (max-width:700px) {
  .post-meta-header {
    align-items: flex-start;
  }

  .post-header-actions {
    gap: 6px;
  }

  .post-quote-button {
    min-height: 30px;
    padding: 4px 8px;
  }
}

/* Milestone 2C — edit own post */

.post-edit-button {
  appearance: none;
  border: 1px solid #cbd5dc;
  border-radius: 5px;
  background: #fff;
  color: var(--navy-2);
  padding: 3px 7px;
  font: inherit;
  font-size: .72rem;
  font-weight: 900;
  line-height: 1.2;
  cursor: pointer;
}

.post-edit-button:hover {
  border-color: var(--red);
  color: var(--red);
}

.inline-post-editor {
  display: none;
  margin: 8px 0 0;
}

.inline-post-editor.is-open {
  display: block;
}

.inline-post-editor textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid #cbd5dc;
  border-radius: 6px;
  padding: 9px 10px;
  font: inherit;
  line-height: 1.45;
}

.inline-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 7px;
}

@media (max-width:700px) {
  .post-edit-button {
    min-height: 30px;
    padding: 4px 8px;
  }
}

/* Milestone 2C — report post */

.post-report-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 3px 2px;
  font: inherit;
  font-size: .7rem;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
}

.post-report-button:hover {
  color: var(--red);
  text-decoration: underline;
}

.inline-post-report {
  display: none;
  margin: 8px 0 0;
  padding: 10px;
  border: 1px solid #d7dee3;
  border-radius: 7px;
  background: #f7f9fa;
}

.inline-post-report.is-open {
  display: block;
}

.inline-report-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.inline-report-heading strong {
  color: var(--navy-2);
  font-size: .86rem;
}

.inline-report-heading span {
  color: var(--muted);
  font-size: .72rem;
}

.inline-post-report label {
  display: block;
  margin-top: 7px;
  color: var(--navy-2);
  font-size: .76rem;
  font-weight: 900;
}

.inline-post-report select,
.inline-post-report textarea {
  width: 100%;
  margin-top: 4px;
  border: 1px solid #cbd5dc;
  border-radius: 6px;
  background: #fff;
  color: inherit;
  font: inherit;
}

.inline-post-report select {
  height: 35px;
  padding: 0 8px;
}

.inline-post-report textarea {
  min-height: 78px;
  resize: vertical;
  padding: 8px 9px;
  line-height: 1.4;
}

.report-optional {
  color: var(--muted);
  font-weight: 700;
}

.inline-report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 8px;
}

@media (max-width:700px) {
  .post-report-button {
    min-height: 30px;
    padding: 4px;
  }

  .inline-post-report {
    padding: 9px;
  }
}
