:root {
  /* Forum card palette from platform.html. */
  --module-primary: #147a70;
  --module-primary-dark: color-mix(in srgb, var(--module-primary) 78%, #000000);
  --module-primary-light: #e4f4f2;
  --module-on-light: var(--module-primary);
  --module-primary-border: color-mix(in srgb, var(--module-primary) 30%, #ffffff);
  --module-focus: var(--module-primary);
  --brand-green: var(--module-on-light);
  --brand-green-dark: var(--module-primary-dark);
  --brand-green-soft: var(--module-primary-light);
  --brand-green-border: var(--module-primary-border);
  --cream: #f7f3e8;
  --cream-dark: #eee8da;
  --white: #ffffff;
  --text: #17211d;
  --muted: #65716a;
  --border: #d8ded9;
  --danger: #a33434;
  --shadow: 0 18px 48px color-mix(in srgb, var(--module-primary) 9%, transparent);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 6%, color-mix(in srgb, var(--module-primary-light) 90%, transparent), transparent 28rem),
    linear-gradient(135deg, var(--cream) 0%, var(--module-primary-light) 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--module-focus);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.nav {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand-logo {
  display: block;
  width: auto;
  height: 60px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--brand-green);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.nav-links a.active {
  border-bottom: 2px solid var(--brand-green);
}

.nav-links a.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.logout-button,
.primary-button,
.secondary-button,
.load-more-button {
  border-radius: 999px;
  font-weight: 800;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.logout-button,
.primary-button {
  border: 0;
  padding: 11px 18px;
  color: var(--white);
  background: var(--brand-green);
}

.logout-button:hover,
.primary-button:hover {
  background: var(--brand-green-dark);
  transform: translateY(-1px);
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 42px 24px 80px;
}

.forum-hero {
  position: relative;
  overflow: hidden;
  min-height: 300px;
  padding: 48px;
  border-radius: 32px;
  color: var(--white);
  background:
    radial-gradient(circle at 92% 15%, rgba(255, 255, 255, 0.13) 0 6rem, transparent 6.1rem),
    radial-gradient(circle at 82% 105%, rgba(255, 255, 255, 0.08) 0 12rem, transparent 12.1rem),
    var(--brand-green);
  box-shadow: 0 24px 60px color-mix(in srgb, var(--module-primary) 20%, transparent);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 690px;
}

.eyebrow,
.section-label {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--module-primary-light);
}

.section-label {
  color: var(--brand-green);
}

.forum-hero h1 {
  margin: 0;
  font-size: clamp(38px, 5.5vw, 66px);
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.hero-description {
  max-width: 630px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 17px;
  line-height: 1.65;
}

.hero-button {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  padding: 14px 22px;
  color: var(--brand-green);
  background: var(--white);
}

.hero-button:hover {
  color: var(--brand-green-dark);
  background: var(--cream);
}

.hero-button span {
  margin-right: 7px;
  font-size: 20px;
  line-height: 0;
}

.forum-layout {
  margin-top: 28px;
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.forum-sidebar,
.discussion-panel {
  border: 1px solid var(--brand-green-border);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.forum-sidebar {
  position: sticky;
  top: 118px;
  overflow: hidden;
}

.sidebar-heading {
  padding: 25px 24px 16px;
}

.sidebar-heading h2,
.discussion-heading h2,
.dialog-header h2 {
  margin: 0;
  color: var(--brand-green);
  font-size: 24px;
}

.category-list {
  padding: 0 12px 18px;
}

.category-item {
  width: 100%;
  min-height: 66px;
  padding: 11px 12px;
  border: 0;
  border-radius: 16px;
  color: var(--text);
  background: transparent;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  text-align: left;
}

.category-item:hover {
  background: color-mix(in srgb, var(--module-primary-light) 55%, #ffffff);
}

.category-item.active {
  color: var(--brand-green);
  background: var(--brand-green-soft);
}

.category-icon {
  width: 31px;
  height: 31px;
  border-radius: 10px;
  color: var(--brand-green);
  background: var(--white);
  display: grid;
  place-items: center;
  font-weight: 900;
}

.category-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.category-copy strong,
.category-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-copy strong {
  font-size: 14px;
}

.category-copy small {
  color: var(--muted);
  font-size: 11px;
}

.category-count {
  min-width: 24px;
  padding: 4px 6px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--white);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.category-loading {
  padding: 8px 12px;
  display: grid;
  gap: 10px;
}

.category-loading span {
  height: 45px;
  border-radius: 12px;
  background: linear-gradient(90deg, #eef1ee 25%, #f8faf8 50%, #eef1ee 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.guidelines-card {
  padding: 24px;
  border-top: 1px solid var(--border);
  background: var(--cream);
}

.guidelines-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--white);
  background: var(--brand-green);
  display: grid;
  place-items: center;
}

.guidelines-card h3 {
  margin: 15px 0 8px;
  color: var(--brand-green);
  font-size: 15px;
}

.guidelines-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.discussion-panel {
  min-height: 620px;
  padding: 28px;
}

.discussion-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
}

.discussion-count {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 13px;
}

.forum-toolbar {
  margin: 23px 0 18px;
  display: grid;
  grid-template-columns: minmax(200px, 1fr) auto;
  gap: 12px;
}

.search-field {
  min-height: 48px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: #fafcfb;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-field:focus-within {
  border-color: var(--brand-green);
  box-shadow: 0 0 0 3px var(--module-focus);
}

.search-field svg {
  width: 19px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.search-field input::placeholder {
  color: #8a948e;
}

.sort-field {
  min-height: 48px;
  padding: 0 10px 0 14px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: #fafcfb;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sort-field select {
  border: 0;
  outline: 0;
  color: var(--brand-green);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

.topics-list {
  display: grid;
  gap: 12px;
}

.topic-card {
  width: 100%;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 19px;
  color: inherit;
  background: var(--white);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.topic-card:hover {
  border-color: var(--brand-green-border);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--module-primary) 8%, transparent);
  transform: translateY(-1px);
}

.topic-main {
  min-width: 0;
}

.topic-meta,
.topic-footer,
.topic-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.topic-meta {
  gap: 8px;
}

.category-pill,
.pinned-pill,
.locked-pill {
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.category-pill {
  color: var(--brand-green);
  background: var(--brand-green-soft);
}

.pinned-pill {
  color: #77540b;
  background: #fff3cc;
}

.locked-pill {
  color: var(--muted);
  background: #edf0ee;
}

.topic-card h3 {
  margin: 12px 0 7px;
  color: var(--brand-green);
  font-size: 19px;
  line-height: 1.25;
}

.topic-excerpt {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.topic-footer {
  margin-top: 14px;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.author-avatar {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  color: var(--white);
  background: var(--brand-green);
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  font-weight: 900;
  overflow: hidden;
  flex: 0 0 25px;
}

.author-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.topic-stats {
  min-width: 90px;
  align-self: center;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.topic-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.topic-stat.liked {
  color: #b3375a;
}

.topic-stats svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.topics-loading {
  display: grid;
  gap: 12px;
}

.topic-skeleton {
  height: 150px;
  border-radius: 19px;
  background: linear-gradient(90deg, #eef1ee 25%, #f8faf8 50%, #eef1ee 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

.forum-notice {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid #e1c88c;
  border-radius: 14px;
  color: #644d18;
  background: #fff8e5;
  font-size: 13px;
  line-height: 1.5;
}

.forum-notice.error {
  border-color: #e5baba;
  color: var(--danger);
  background: #fff1f1;
}

.empty-state {
  padding: 70px 24px;
  text-align: center;
}

.empty-icon {
  width: 50px;
  height: 50px;
  margin: 0 auto;
  border-radius: 17px;
  color: var(--brand-green);
  background: var(--brand-green-soft);
  display: grid;
  place-items: center;
  font-size: 22px;
}

.empty-state h3 {
  margin: 17px 0 8px;
  color: var(--brand-green);
}

.empty-state p {
  max-width: 420px;
  margin: 0 auto 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.secondary-button,
.load-more-button {
  padding: 11px 18px;
  border: 1px solid var(--brand-green);
  color: var(--brand-green);
  background: var(--white);
}

.secondary-button:hover,
.load-more-button:hover {
  color: var(--white);
  background: var(--brand-green);
}

.load-more-button {
  margin: 22px auto 0;
  display: block;
}

.forum-dialog {
  width: min(680px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--brand-green-border);
  border-radius: 26px;
  color: var(--text);
  background: var(--white);
  box-shadow: 0 28px 90px color-mix(in srgb, var(--module-primary-dark) 30%, transparent);
}

.forum-dialog::backdrop {
  background: rgba(8, 32, 20, 0.6);
  backdrop-filter: blur(4px);
}

.dialog-header {
  padding: 25px 28px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.dialog-close {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  background: var(--white);
  font-size: 25px;
  line-height: 1;
}

.dialog-close:hover {
  color: var(--white);
  background: var(--brand-green);
}

.topic-form {
  padding: 24px 28px 28px;
  display: grid;
  gap: 18px;
}

.topic-form label,
.comment-form label {
  color: var(--brand-green);
  font-size: 13px;
  font-weight: 800;
  display: grid;
  gap: 8px;
}

.topic-form input,
.topic-form select,
.topic-form textarea,
.comment-form textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  outline: 0;
  color: var(--text);
  background: #fafcfb;
  line-height: 1.5;
}

.topic-form textarea,
.comment-form textarea {
  resize: vertical;
}

.attachment-picker input {
  width: 100%;
  padding: 10px;
  border: 1px dashed var(--brand-green-border);
  border-radius: 13px;
  background: var(--brand-green-soft);
  color: var(--text);
  cursor: pointer;
}

.attachment-picker input::file-selector-button {
  margin-right: 12px;
  padding: 8px 13px;
  border: 0;
  border-radius: 999px;
  background: var(--brand-green);
  color: var(--white);
  font-weight: 800;
  cursor: pointer;
}

.attachment-picker span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.forum-attachments {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.forum-attachment {
  width: min(100%, 680px);
  overflow: hidden;
  border: 1px solid var(--brand-green-border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--module-primary-light) 55%, #ffffff);
}

.attachment-download {
  width: fit-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--brand-green);
  text-decoration: none;
}

.forum-attachment:has(.attachment-download:hover) {
  background: var(--brand-green-soft);
}

.attachment-download > span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.forum-attachments strong {
  overflow-wrap: anywhere;
}

.forum-attachments small {
  color: var(--muted);
}

.attachment-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--brand-green);
  color: var(--white);
  font-size: 18px;
  font-weight: 900;
}

.attachment-image-preview {
  width: 100%;
  max-height: 520px;
  display: block;
  object-fit: contain;
  background: var(--module-primary-light);
}

.attachment-pdf-preview {
  width: 100%;
  height: min(65vh, 600px);
  display: block;
  border: 0;
  background: var(--white);
}

.attachment-media-preview,
.attachment-audio-preview {
  width: 100%;
  display: block;
  background: #17211d;
}

.attachment-audio-preview {
  padding: 10px;
}

.topic-form input:focus,
.topic-form select:focus,
.topic-form textarea:focus,
.comment-form textarea:focus {
  border-color: var(--brand-green);
  box-shadow: 0 0 0 3px var(--module-focus);
}

.dialog-actions {
  padding-top: 4px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.text-button {
  padding: 10px 14px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.text-button:hover {
  color: var(--brand-green);
}

.form-message {
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--danger);
  background: #fff1f1;
  font-size: 13px;
  line-height: 1.5;
}

.topic-dialog {
  width: min(800px, calc(100% - 32px));
}

.topic-detail {
  padding: 28px;
}

.topic-detail-title {
  margin: 14px 50px 10px 0;
  color: var(--brand-green);
  font-size: clamp(25px, 4vw, 36px);
  line-height: 1.15;
}

.topic-detail-body {
  margin: 24px 0 0;
  color: #38443e;
  line-height: 1.75;
  white-space: pre-wrap;
}

.topic-actions {
  margin-top: 22px;
  display: flex;
}

.topic-like-button {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--white);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.topic-like-button:hover {
  border-color: #d9a0b1;
  color: #9f294c;
}

.topic-like-button.liked {
  border-color: #e5b3c2;
  color: #9f294c;
  background: #fff1f5;
}

.topic-like-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.topic-like-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.topic-like-button.liked svg {
  fill: currentColor;
}

.topic-dialog-close {
  position: absolute;
  top: 22px;
  right: 22px;
}

.comments-section {
  padding: 25px 28px 28px;
  border-top: 1px solid var(--border);
  background: #fafcfb;
}

.comments-section h3 {
  margin: 0 0 18px;
  color: var(--brand-green);
}

.comments-list {
  display: grid;
  gap: 12px;
}

.comment-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--white);
}

.comment-card p {
  margin: 10px 0 0;
  color: #38443e;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.comment-form {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 12px;
}

.comment-form .primary-button {
  justify-self: end;
}

.dialog-loading {
  padding: 80px 24px;
  color: var(--muted);
  text-align: center;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .forum-hero {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .forum-sidebar {
    position: static;
  }

  .category-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }

  .category-loading {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    gap: 13px;
  }

  .brand-logo {
    height: 48px;
  }

  .page {
    padding: 24px 14px 60px;
  }

  .forum-hero {
    min-height: 0;
    padding: 34px 25px;
    border-radius: 24px;
  }

  .hero-button {
    width: 100%;
  }

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

  .discussion-panel {
    padding: 21px 16px;
  }

  .discussion-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

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

  .sort-field {
    justify-content: space-between;
  }

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

  .topic-stats {
    justify-content: flex-start;
  }

  .dialog-header,
  .topic-form,
  .topic-detail,
  .comments-section {
    padding-left: 20px;
    padding-right: 20px;
  }
}
