.community-shell {
  display: grid;
  gap: 32px;
}

.page-shell[data-community-app] {
  display: grid;
  gap: 24px;
}

.community-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  border: 1px solid #e4e5ec;
  border-radius: 18px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 30px rgba(27, 31, 45, 0.06);
  scrollbar-width: thin;
}

.community-tabs a {
  align-items: center;
  background: #fff;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #4b4f5d;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.9rem;
  font-weight: 750;
  min-height: 44px;
  padding: 0 18px;
  text-decoration: none;
}

.community-tabs a[aria-current="page"],
.community-tabs a:hover {
  background: #fff0eb;
  border-color: #ffd2c3;
  color: #a92413;
}

.community-status {
  border: 1px solid transparent;
  border-radius: 14px;
  font-weight: 700;
  min-height: 0;
  padding: 0;
}

.community-status:not(:empty) {
  background: #f8fafc;
  border-color: #cbd5e1;
  padding: 12px 14px;
}

.community-status[data-tone="success"] {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.community-status[data-tone="warning"] {
  background: #fffbeb;
  border-color: #fde68a;
  color: #854d0e;
}

.community-status[data-tone="error"] {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #9f1239;
}

.community-layout {
  align-items: start;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) 300px;
}

.community-home-feeds {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.community-home-feeds > section {
  min-width: 0;
  border: 1px solid #e4e5ec;
  border-radius: 24px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 14px 35px rgba(27, 31, 45, 0.06);
}

.community-home-feeds h3 {
  color: #172033;
  margin: 0;
}

.community-feed {
  display: grid;
  gap: 12px;
}

.community-thread-card,
.community-panel,
.community-post,
.community-reply,
.community-editorial-card {
  background: #fff;
  border: 1px solid #e4e5ec;
  border-radius: 22px;
  box-shadow: 0 14px 36px rgba(27, 31, 45, 0.065);
}

.community-thread-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  transition: border-color 170ms ease, box-shadow 170ms ease, transform 170ms ease;
}

.community-thread-card::before {
  position: absolute;
  width: 5px;
  inset: 18px auto 18px 0;
  border-radius: 0 6px 6px 0;
  background: linear-gradient(180deg, #d93618, #ff9b26);
  content: "";
}

.community-thread-card:hover {
  border-color: #f2b9a7;
  box-shadow: 0 20px 46px rgba(61, 42, 37, 0.11);
  transform: translateY(-2px);
}

.community-thread-card__title {
  font-size: 1.08rem;
  line-height: 1.35;
  margin: 0;
}

.community-thread-card__link {
  color: #171922;
  text-decoration: none;
}

.community-thread-card__link:hover {
  color: #a92413;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.community-thread-card__meta,
.community-thread-card__facts {
  color: #596579;
  font-size: 0.85rem;
  margin: 8px 0 0;
}

.community-thread-card__excerpt {
  color: #4c5260;
  line-height: 1.65;
  margin: 12px 0 0;
}

.community-thread-card__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.community-thread-card__fact {
  border: 1px solid #e7e8ee;
  background: #f7f7fa;
  border-radius: 999px;
  color: #475569;
  font-weight: 750;
  padding: 5px 9px;
}

.community-thread-card__fact--resolved {
  background: #dcfce7;
  color: #166534;
}

.community-panel {
  padding: 24px;
}

.community-panel h2,
.community-panel h3 {
  color: #171922;
  margin-top: 0;
}

.community-panel p {
  color: #555b69;
  line-height: 1.6;
}

.community-form {
  display: grid;
  gap: 16px;
}

.community-field {
  display: grid;
  gap: 7px;
}

.community-field label,
.community-legend {
  color: #30333e;
  font-size: 0.9rem;
  font-weight: 800;
}

.community-field input,
.community-field select,
.community-field textarea {
  background: #fff;
  border: 1px solid #cfd1da;
  border-radius: 13px;
  color: #171922;
  font: inherit;
  min-height: 48px;
  padding: 12px 14px;
  width: 100%;
}

.community-field textarea {
  line-height: 1.55;
  min-height: 150px;
  resize: vertical;
}

.community-field input::placeholder,
.community-field textarea::placeholder {
  color: #596579;
  opacity: 1;
}

.community-field input:focus-visible,
.community-field select:focus-visible,
.community-field textarea:focus-visible,
.community-button:focus-visible,
.community-tabs a:focus-visible,
.community-thread-card__link:focus-visible {
  outline: 3px solid #A92413;
  outline-offset: 2px;
}

.community-choice-grid {
  border: 0;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 0;
}

.community-choice {
  align-items: flex-start;
  background: #fafafd;
  border: 1px solid #e1e2e9;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  min-height: 56px;
  padding: 12px;
}

.community-choice:has(input:checked) {
  background: #fff0eb;
  border-color: #f1a68e;
}

.community-button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 13px;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 800;
  justify-content: center;
  min-height: 48px;
  padding: 0 17px;
  text-decoration: none;
}

.community-button--primary {
  background: #a92413;
  box-shadow: 0 10px 24px rgba(169, 36, 19, 0.18);
  color: #fff;
}

.community-button--primary:hover {
  background: #881c0f;
  color: #ffffff;
}

.community-button--secondary {
  background: #fff;
  border-color: #cbd5e1;
  color: #30333e;
}

.community-button--danger {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #9f1239;
}

.community-button[disabled],
[aria-busy="true"] .community-button {
  cursor: wait;
  opacity: 0.65;
}

.community-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.community-empty-state {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0, rgba(255, 173, 122, 0.18), transparent 13rem),
    linear-gradient(145deg, #ffffff, #fff7f3);
  border: 1px dashed #d4c2bc;
  border-radius: 22px;
  padding: 82px 28px 30px;
  text-align: center;
}

.community-empty-state::before {
  position: absolute;
  top: 24px;
  left: 50%;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 15px;
  color: #ffffff;
  background: linear-gradient(145deg, #d93618, #ff7b2b);
  box-shadow: 0 10px 24px rgba(217, 54, 24, 0.2);
  content: "?";
  font-size: 20px;
  font-weight: 900;
  transform: translateX(-50%);
}

.community-empty-state--error {
  background: #fff7ed;
  border-color: #fdba74;
}

.community-empty-state__title {
  color: #171922;
  margin: 0;
}

.community-empty-state__copy {
  color: #555b69;
  margin: 8px auto 0;
  max-width: 58ch;
}

.community-post,
.community-reply {
  padding: 24px;
}

.community-thread-detail,
.community-compose,
.community-signin-prompt {
  background: #fff;
  border: 1px solid #e4e5ec;
  border-radius: 24px;
  box-shadow: 0 16px 42px rgba(27, 31, 45, 0.07);
  padding: clamp(22px, 4vw, 34px);
}

.community-thread-detail h1 {
  color: #171922;
  font-size: clamp(2rem, 6vw, 3.75rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 8px 0 14px;
  overflow-wrap: anywhere;
}

.community-thread-detail__meta {
  color: #596579;
  font-size: 0.9rem;
  margin: 0 0 22px;
}

.community-thread-detail__body,
.community-reply__body {
  color: #404653;
  font-size: 1rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.community-thread-detail__body p,
.community-reply__body p {
  margin: 0 0 1em;
}

.community-section-heading {
  align-items: end;
  display: flex;
  justify-content: space-between;
}

.community-section-heading h2 {
  color: #172033;
  margin: 4px 0 0;
}

.community-compose form,
.community-report-dialog form:not([method="dialog"]) {
  display: grid;
  gap: 10px;
}

.community-compose label,
.community-report-dialog label {
  color: #243047;
  font-size: 0.9rem;
  font-weight: 800;
}

.community-compose textarea,
.community-report-dialog textarea,
.community-report-dialog select {
  background: #fff;
  border: 1px solid #b9c5d6;
  border-radius: 12px;
  color: #172033;
  font: inherit;
  line-height: 1.55;
  min-height: 48px;
  padding: 12px 14px;
  width: 100%;
}

.community-compose textarea,
.community-report-dialog textarea {
  min-height: 140px;
  resize: vertical;
}

.community-action {
  align-items: center;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 800;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
}

.community-action:hover,
.community-action[aria-pressed="true"] {
  background: #fff0eb;
  border-color: #f1a68e;
  color: #a92413;
}

.community-action:focus-visible,
.community-compose textarea:focus-visible,
.community-report-dialog textarea:focus-visible,
.community-report-dialog select:focus-visible {
  outline: 3px solid #A92413;
  outline-offset: 2px;
}

.community-report-dialog {
  background: #fff;
  border: 0;
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
  color: #172033;
  max-width: min(520px, calc(100vw - 32px));
  padding: 24px;
  width: 100%;
}

.community-report-dialog::backdrop {
  background: rgba(15, 23, 42, 0.56);
}

.community-dialog-close {
  align-items: center;
  background: #f1f5f9;
  border: 0;
  border-radius: 50%;
  color: #334155;
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 1.4rem;
  height: 44px;
  justify-content: center;
  margin-left: auto;
  width: 44px;
}

.community-post__meta,
.community-reply__meta {
  color: #596579;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.86rem;
  gap: 8px;
}

.community-post__body,
.community-reply__body {
  color: #283449;
  font-size: 1rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.community-replies {
  display: grid;
  gap: 14px;
}

.community-reply--accepted {
  border-color: #86efac;
  box-shadow: 0 14px 40px rgba(22, 163, 74, 0.09);
}

.community-accepted-label {
  align-items: center;
  background: #dcfce7;
  border-radius: 999px;
  color: #166534;
  display: inline-flex;
  font-size: 0.8rem;
  font-weight: 850;
  min-height: 28px;
  padding: 0 10px;
}

.community-vote {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.community-vote button {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  color: #475569;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  min-height: 44px;
  min-width: 44px;
}

.community-vote button[aria-pressed="true"] {
  background: #fff0eb;
  border-color: #f1a68e;
  color: #a92413;
}

.community-byline {
  align-items: center;
  display: flex;
  gap: 10px;
}

.community-avatar {
  align-items: center;
  background: #fff0eb;
  border-radius: 50%;
  color: #a92413;
  display: inline-flex;
  flex: 0 0 auto;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.community-dialog {
  background: #fff;
  border: 0;
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
  color: #172033;
  max-width: min(520px, calc(100vw - 32px));
  padding: 24px;
  width: 100%;
}

.community-dialog::backdrop {
  background: rgba(15, 23, 42, 0.56);
}

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

.community-moderation-item {
  background: #fff;
  border: 1px solid #e4e5ec;
  border-radius: 16px;
  padding: 18px;
}

.community-report-target {
  background: #f7fafc;
  border: 1px solid #e4e5ec;
  border-left: 4px solid #d93618;
  border-radius: 12px;
  display: grid;
  gap: 8px;
  margin: 14px 0;
  padding: 14px;
}

.community-report-target h4,
.community-report-target p {
  margin: 0;
}

.community-report-target .community-button {
  justify-self: start;
}

.community-auth-card {
  background: linear-gradient(145deg, #fff3ee, #fff0eb);
  border: 1px solid #f3c8b9;
  border-radius: 24px;
  padding: clamp(22px, 4vw, 32px);
  box-shadow: 0 16px 42px rgba(63, 45, 40, 0.07);
}

[data-auth-visible][hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  .community-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .community-layout__aside {
    order: -1;
  }

  .community-home-feeds {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .community-shell {
    gap: 20px;
  }

  .community-thread-card,
  .community-panel,
  .community-post,
  .community-reply,
  .community-thread-detail,
  .community-compose,
  .community-signin-prompt {
    border-radius: 16px;
    padding: 16px;
  }

  .community-thread-detail h1 {
    font-size: 2rem;
  }

  .community-choice-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .community-actions .community-button {
    flex: 1 1 100%;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .community-button,
  .community-tabs a,
  .community-thread-card__link {
    scroll-behavior: auto;
    transition: none;
  }
}
