/* forum.css — shared stylesheet for all three forum pages
 * Tokens sourced from design-tokens.css. Pure CSS, no Bootstrap dependency.
 * Sections:
 *  1. Base & reset
 *  2. Typography scale
 *  3. Layout shells
 *  4. Breadcrumbs
 *  5. Section header
 *  6. Buttons
 *  7. State badges (pin / lock / shield)
 *  8. Author chip (inline + block)
 *  9. Topic row
 * 10. Category card
 * 11. Post card (OP + reply)
 * 12. Reply form
 * 13. Pagination
 * 14. Empty state
 * 15. Sidebar
 * 16. Modal
 * 17. Forum identity header
 * 18. Most-active members
 * 19. Member actions bar
 * 20. Topic header
 * 21. State toggle (demo switcher)
 * 22. Nav / footer stubs
 * 23. Utilities
 * 24. Responsive
 */

/* ─── 1. Base & reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue-900: #0d2e52;
  --blue-800: #1a4a7a;
  --blue-700: #1e5fa0;
  --blue-600: #2672b8;
  --blue-100: #ddeaf7;
  --blue-50:  #f0f6fc;
  --gold:     #b8924a;
  --gold-lt:  #f5edd8;

  --text-900: #1a1e26;
  --text-700: #3c4352;
  --text-500: #6b7280;
  --text-300: #adb5bd;

  --bg:       #fafbfc;
  --bg-alt:   #f2f5f9;
  --bg-card:  #ffffff;
  --border:   #e2e8f0;

  --radius:    10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.06);

  --pin-color:    #1e5fa0;
  --lock-color:   #6b7280;
  --shield-color: #b8924a;
  --special-color: #5b3fa0;
}

body {
  font-family: 'Source Sans 3', system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--text-900);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Lora', Georgia, serif;
  color: var(--blue-900);
  line-height: 1.25;
}

a { color: var(--blue-700); text-decoration: none; }
a:hover { color: var(--blue-900); text-decoration: underline; }
img { display: block; max-width: 100%; }

/* ─── 2. Typography scale ─── */
.text-xs   { font-size: .75rem; }
.text-sm   { font-size: .875rem; }
.text-base { font-size: 1rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }
.text-2xl  { font-size: 1.5rem; }
.text-3xl  { font-size: 1.875rem; }

.font-serif { font-family: 'Lora', Georgia, serif; }
.font-sans  { font-family: 'Source Sans 3', system-ui, sans-serif; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold   { font-weight: 700; }

.text-muted  { color: var(--text-500); }
.text-subtle { color: var(--text-300); }
.text-blue   { color: var(--blue-700); }
.text-gold   { color: var(--gold); }

/* ─── 3. Layout shells ─── */
.forum-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Two-column: main + sidebar */
.forum-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
  align-items: start;
}

.forum-main   { min-width: 0; }
.forum-aside  { min-width: 0; }

/* Full-width single column */
.forum-single { max-width: 760px; margin: 0 auto; }

.forum-page-body {
  padding: 32px 0 64px;
}

/* ─── 5. Section header ─── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 12px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0;
}

.section-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--blue-900);
  letter-spacing: -.01em;
}

.section-header .section-meta {
  font-size: .8rem;
  color: var(--text-500);
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 400;
}

/* ─── 6. Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 8px 18px;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--blue-700);
  color: #fff;
  border-color: var(--blue-700);
}
.btn-primary:hover { background: var(--blue-900); border-color: var(--blue-900); color: #fff; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--blue-700);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--blue-700); color: var(--blue-900); background: var(--blue-50); }

.btn-gold {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}
.btn-gold:hover { background: #a07840; border-color: #a07840; color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-500);
  border-color: transparent;
  padding: 6px 10px;
}
.btn-ghost:hover { background: var(--bg-alt); color: var(--text-700); }

.btn-danger {
  background: #fff;
  color: #c0392b;
  border-color: #f5c6c2;
}
.btn-danger:hover { background: #fff0ee; border-color: #c0392b; }

.btn-sm {
  font-size: .78rem;
  padding: 5px 12px;
}

.btn-xs {
  font-size: .72rem;
  padding: 3px 9px;
  border-radius: 6px;
}

/* ─── 7. State badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .7rem;
  font-weight: 700;
  font-family: 'Source Sans 3', sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-pin {
  background: var(--blue-50);
  color: var(--blue-700);
  border: 1px solid var(--blue-100);
}
.badge-lock {
  background: var(--bg-alt);
  color: var(--text-500);
  border: 1px solid var(--border);
}
.badge-shield {
  background: var(--gold-lt);
  color: #8a6520;
  border: 1px solid #e8d5a8;
}
.badge-role-admin {
  background: var(--blue-900);
  color: #fff;
}
.badge-role-mod {
  background: var(--blue-700);
  color: #fff;
}
.badge-role-leader {
  background: var(--gold-lt);
  color: #7a5c20;
  border: 1px solid #e0c88a;
}
.badge-related {
  background: #f0ebfa;
  color: var(--special-color);
  border: 1px solid #d8c8f0;
  font-size: .72rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  padding: 2px 8px;
  border-radius: 20px;
}
.badge-new {
  background: var(--blue-700);
  color: #fff;
  font-size: .65rem;
  padding: 1px 6px;
  border-radius: 3px;
  vertical-align: middle;
}

/* ─── 8. Author chip ─── */
.author-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

/* Inline (small) — used in topic rows */
.author-chip-sm .author-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-alt);
}
.author-chip-sm .author-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Block (large) — used on post cards */
.author-chip-lg {
  gap: 10px;
}
.author-chip-lg .author-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-alt);
  box-shadow: var(--shadow-sm);
}
.author-chip-lg .author-name {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-900);
  line-height: 1.2;
}
.author-chip-lg .author-meta {
  font-size: .78rem;
  color: var(--text-500);
  margin-top: 1px;
}

/* Avatar placeholder */
.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-100);
  color: var(--blue-700);
  font-weight: 700;
  font-family: 'Source Sans 3', sans-serif;
  flex-shrink: 0;
}
.avatar-placeholder-sm {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: .6rem;
}
.avatar-placeholder-lg {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: .9rem;
}
.avatar-placeholder-xl {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 1.1rem;
}

/* ─── 9. Topic row ─── */
.topic-list {
  list-style: none;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.topic-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.topic-row:last-child { border-bottom: none; }
.topic-row:hover { background: var(--blue-50); }

.topic-row-pinned {
  background: linear-gradient(90deg, rgba(240,246,252,0.6) 0%, transparent 100%);
}
.topic-row-pinned:hover { background: var(--blue-50); }

.topic-row-locked {
  opacity: .85;
}

.topic-row-main {
  padding: 14px 16px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.topic-row-title-line {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  flex-wrap: wrap;
}

.topic-row-icons {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  padding-top: 2px;
}

.topic-row-icon {
  width: 14px;
  height: 14px;
  opacity: .7;
}

.topic-title {
  font-family: 'Source Sans 3', sans-serif;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-900);
  line-height: 1.35;
  text-wrap: pretty;
}
.topic-title:hover { color: var(--blue-700); text-decoration: none; }

.topic-row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: .775rem;
  color: var(--text-500);
}

.topic-row-meta .sep {
  color: var(--text-300);
}

.topic-category-crumb {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--blue-600);
  background: var(--blue-50);
  padding: 1px 7px;
  border-radius: 3px;
}
.topic-category-crumb:hover { text-decoration: none; color: var(--blue-900); }

.topic-row-stats {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  border-left: 1px solid var(--border);
  min-width: 100px;
  flex-shrink: 0;
}

.topic-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .775rem;
  color: var(--text-500);
  font-family: 'Source Sans 3', sans-serif;
}

.topic-stat-count {
  font-weight: 700;
  color: var(--text-700);
}

.topic-last-activity {
  font-size: .72rem;
  color: var(--text-500);
  text-align: right;
  line-height: 1.4;
}

/* ─── 10. Category card ─── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow .15s, border-color .15s;
}
.category-card:hover { box-shadow: var(--shadow); border-color: var(--blue-100); }

.category-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.category-card-name {
  font-family: 'Lora', Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--blue-900);
  line-height: 1.25;
}
.category-card-name:hover { color: var(--blue-700); text-decoration: none; }

.category-card-desc {
  font-size: .855rem;
  color: var(--text-500);
  line-height: 1.55;
  text-wrap: pretty;
}

.category-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.category-card-counts {
  display: flex;
  gap: 12px;
  font-size: .775rem;
  color: var(--text-500);
}
.category-card-counts strong { color: var(--text-700); font-weight: 600; }

.category-card-latest {
  font-size: .75rem;
  color: var(--text-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}
.category-card-latest a {
  color: var(--text-500);
  font-style: italic;
}
.category-card-latest a:hover { color: var(--blue-700); }

.category-card-empty .category-card-latest {
  color: var(--text-300);
  font-style: italic;
}

/* ─── 11. Post card (OP + reply) ─── */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.post-card-op {
  border-color: var(--blue-100);
  box-shadow: var(--shadow);
}

.post-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.post-card-op .post-card-header {
  background: var(--blue-50);
  border-bottom-color: var(--blue-100);
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .78rem;
  color: var(--text-500);
  flex-shrink: 0;
}

.post-number {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-300);
  letter-spacing: .04em;
}

.post-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.post-card-body {
  padding: 18px 20px;
  font-size: .95rem;
  line-height: 1.7;
  color: var(--text-900);
}

/* Rich content inside posts */
.post-content p       { margin-bottom: 1em; }
.post-content p:last-child { margin-bottom: 0; }
.post-content ul,
.post-content ol      { padding-left: 1.5em; margin-bottom: 1em; }
.post-content li      { margin-bottom: .3em; }
.post-content blockquote {
  border-left: 3px solid var(--blue-100);
  padding: 8px 16px;
  margin: 12px 0;
  background: var(--blue-50);
  border-radius: 0 6px 6px 0;
  color: var(--text-700);
  font-style: italic;
}
.post-content code {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: .875em;
  font-family: 'Courier New', monospace;
  color: var(--text-700);
}
.post-content pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 12px 0;
}
.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: .85rem;
}
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  margin: 1.25em 0 .5em;
  font-size: 1rem;
}

.post-card-footer {
  padding: 8px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  font-size: .75rem;
  color: var(--text-500);
  font-style: italic;
}

/* ─── 12. Reply form ─── */
.reply-form-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.reply-form-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-700);
}

.reply-form-body {
  padding: 18px;
}

.form-group {
  margin-bottom: 16px;
}
.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-700);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 9px 13px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: .9rem;
  color: var(--text-900);
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.5;
}
.form-control:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(38,114,184,.12);
}

.form-control-textarea {
  min-height: 140px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7280' d='M8 11L2 5h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 32px;
  cursor: pointer;
}

.slug-preview {
  font-size: .78rem;
  color: var(--text-500);
  margin-top: 5px;
  font-family: monospace;
}

.form-error {
  background: #fff0ee;
  border: 1px solid #f5c6c2;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: .875rem;
  color: #c0392b;
  margin-bottom: 16px;
}
.form-error ul { padding-left: 1.2em; margin-top: 4px; }
.form-error li { margin-bottom: 2px; }

.locked-notice,
.login-callout {
  padding: 20px 22px;
  border-radius: var(--radius);
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: 14px;
}
.locked-notice {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-500);
}
.login-callout {
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  color: var(--text-700);
  flex-direction: column;
  align-items: flex-start;
}
.login-callout-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* ─── 13. Pagination ─── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  padding: 20px 0;
  flex-wrap: wrap;
}

.page-item {
  display: inline-flex;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-700);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all .12s;
  text-decoration: none;
}
.page-link:hover { background: var(--blue-50); border-color: var(--blue-100); color: var(--blue-700); text-decoration: none; }
.page-link.active { background: var(--blue-700); border-color: var(--blue-700); color: #fff; }
.page-link.disabled { opacity: .4; pointer-events: none; }
.page-link-text { padding: 0 12px; font-size: .82rem; }

/* ─── 14. Empty state ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 52px 24px;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.empty-state-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--blue-50);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.empty-state-icon svg {
  width: 26px;
  height: 26px;
  color: var(--blue-600);
}

.empty-state h3 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.05rem;
  color: var(--text-700);
  font-weight: 600;
}

.empty-state p {
  font-size: .875rem;
  color: var(--text-500);
  max-width: 320px;
  line-height: 1.6;
  text-wrap: pretty;
}

/* ─── 15. Sidebar ─── */
.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

.sidebar-card-header {
  padding: 12px 16px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-500);
}

.sidebar-card-body {
  padding: 14px 16px;
}

.sidebar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: .845rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-row:last-child { border-bottom: none; }
.sidebar-row-label { color: var(--text-500); }
.sidebar-row-value { color: var(--text-700); font-weight: 600; }

.sidebar-nav-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-nav-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: .875rem;
  color: var(--text-700);
  border-radius: 6px;
  transition: background .12s, color .12s;
}
.sidebar-nav-list a:hover { background: var(--blue-50); color: var(--blue-700); text-decoration: none; }

/* ─── 16. Modal ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13,46,82,.45);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-500);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color .12s;
}
.modal-close:hover { color: var(--text-900); }

.modal-body {
  padding: 20px 22px;
}

.modal-footer {
  padding: 14px 22px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-preview {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: .85rem;
  color: var(--text-700);
  font-style: italic;
  margin: 12px 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.modal-danger-notice {
  font-size: .85rem;
  color: #c0392b;
  background: #fff0ee;
  border: 1px solid #f5c6c2;
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 10px;
}

.moderate-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  gap: 12px;
}
.moderate-toggle-row:last-child { border-bottom: none; }
.moderate-toggle-label { color: var(--text-700); font-weight: 500; }

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  cursor: pointer;
  transition: background .15s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--blue-700); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ─── 17. Forum identity header ─── */
.forum-identity {
  background: var(--blue-900);
  border-bottom: 3px solid var(--gold);
  color: #fff;
  padding: 40px 0 36px;
}

.forum-identity h1 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.9rem;
  color: #fff;
  font-weight: 700;
  margin-bottom: 6px;
}

.forum-identity-tagline {
  color: rgba(255,255,255,.75);
  font-size: 1rem;
  max-width: 480px;
  text-wrap: pretty;
  margin-bottom: 24px;
}

.forum-stats {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}

.forum-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.forum-stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'Lora', Georgia, serif;
  color: #fff;
  line-height: 1;
}

.forum-stat-label {
  font-size: .78rem;
  color: rgba(255,255,255,.6);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 600;
}

/* Category-specific header variant */
.category-identity {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.category-identity-text h1 {
  font-size: 1.4rem;
  margin-bottom: 5px;
}

.category-identity-text p {
  font-size: .9rem;
  color: var(--text-500);
  text-wrap: pretty;
}

/* ─── 18. Most-active members ─── */
.members-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.member-row:last-child { border-bottom: none; }

.member-rank {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-300);
  width: 18px;
  flex-shrink: 0;
  text-align: center;
}

.member-info { flex: 1; min-width: 0; }
.member-name {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-900);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-post-count {
  font-size: .75rem;
  color: var(--text-500);
}

/* ─── 19. Member actions bar ─── */
.member-actions-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.member-actions-bar-anon {
  background: var(--blue-50);
  border-color: var(--blue-100);
}

.member-actions-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-700);
}
.member-actions-sub {
  font-size: .8rem;
  color: var(--text-500);
  margin-top: 1px;
}

.member-actions-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── 20. Topic header ─── */
.topic-header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.topic-header-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.45rem;
  color: var(--blue-900);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 10px;
  text-wrap: pretty;
}

.topic-header-locked .topic-header-title { color: var(--text-500); }

.topic-header-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.topic-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: .8rem;
  color: var(--text-500);
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.topic-header-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── 21. Utilities ─── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.d-none { display: none !important; }
.d-flex { display: flex; }

.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 28px; }

.cluster { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }

.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }

.mod-chrome {
  border: 2px dashed rgba(38,114,184,.25);
  border-radius: var(--radius);
  position: relative;
}
.mod-chrome::before {
  content: 'Mod';
  position: absolute;
  top: -1px; right: 8px;
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--blue-600);
  background: var(--bg-card);
  padding: 0 4px;
  line-height: 1.5;
}

/* ─── 24. Responsive ─── */
@media (max-width: 860px) {
  .forum-layout {
    grid-template-columns: 1fr;
  }
  .forum-aside {
    order: -1;
  }
  /* Swap sidebar to bottom on topic page */
  .forum-layout.topic-layout .forum-aside {
    order: 2;
  }
}

@media (max-width: 640px) {
  .forum-identity { padding: 28px 0 24px; }
  .forum-identity h1 { font-size: 1.45rem; }
  .forum-stats { gap: 20px; }

  .topic-row-stats {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    border-left: none;
    border-top: 1px solid var(--border);
    min-width: auto;
    padding: 8px 16px 12px;
    gap: 14px;
  }

  .topic-row {
    grid-template-columns: 1fr;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .category-identity {
    flex-direction: column;
    gap: 12px;
  }
  .category-identity .btn { align-self: flex-start; }

  .topic-header-title { font-size: 1.2rem; }

  .post-card-header { flex-direction: column; align-items: flex-start; gap: 8px; }

  .modal { border-radius: var(--radius); }

  .member-actions-bar { flex-direction: column; align-items: flex-start; }

  .pagination { gap: 2px; }
  .page-link { min-width: 32px; height: 32px; font-size: .8rem; }
}

@media (max-width: 420px) {
  .forum-wrap { padding: 0 14px; }
  .section-header h2 { font-size: 1rem; }
  .topic-row-main { padding: 12px 12px; }
  .post-card-body { padding: 14px 14px; }
  .post-card-header { padding: 10px 14px; }
}
