:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-muted: #eef4f1;
  --text: #203038;
  --muted: #65747a;
  --line: rgba(32, 48, 56, 0.13);
  --accent: #0f766e;
  --accent-dark: #0b5551;
  --accent-soft: #dbeee9;
  --warm: #b45f43;
  --gold: #e0a83b;
  --shadow: 0 16px 42px rgba(30, 48, 56, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  min-height: 100vh;
  font-family: "Avenir Next", "Hiragino Sans", "Yu Gothic", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  display: grid;
  gap: 28px;
  width: min(520px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-copy {
  display: grid;
  gap: 8px;
}

.login-copy h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
}

.login-form {
  grid-template-columns: 1fr;
}

.auth-tabs {
  width: 100%;
}

.auth-tabs button {
  flex: 1;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: #f9faf7;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.side-nav {
  display: grid;
  gap: 6px;
  margin-top: 32px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.side-nav a:active {
  transform: scale(0.98);
}

.nav-icon,
.nav-label-mobile {
  display: none;
}

.side-nav-sub {
  display: grid;
  gap: 2px;
  margin: -2px 0 6px 12px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.side-nav-sub a {
  padding: 7px 10px;
  font-size: 0.86rem;
  font-weight: 700;
}

.side-nav a:hover,
.side-nav a.is-current {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.main {
  width: min(1180px, calc(100vw - 288px));
  margin: 0 auto;
  padding: 28px 20px 52px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.topbar h1,
.hero-panel h2,
.status-card h2,
.panel h2,
.list-card h3,
.project-card h3,
.project-directory-card h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 2rem;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--warm);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
  line-height: 1.75;
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 220px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

.profile-chip img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
}

.profile-chip strong,
.profile-chip small {
  display: block;
}

.profile-chip small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.member-hero {
  display: grid;
}

.hero-panel,
.status-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.9fr);
  gap: 24px;
  padding: 24px;
}

.hero-panel h2 {
  font-size: 2.25rem;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.mini-metrics div {
  display: grid;
  align-content: center;
  gap: 6px;
  min-height: 104px;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-muted);
}

.mini-metrics dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.mini-metrics dd {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.status-card {
  display: grid;
  gap: 12px;
  align-content: center;
  padding: 22px;
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 10px 15px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary-button {
  background: var(--accent-dark);
}

.danger-button {
  color: #fff;
  background: var(--warm);
  font-weight: 800;
}

.action-link {
  color: #fff;
  text-decoration: none;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.profile-grid {
  align-items: start;
}

.panel {
  padding: 22px;
}

.panel-wide {
  grid-column: 1 / -1;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.build-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 30px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 5px 10px;
  color: #7a5400;
  background: rgba(224, 168, 59, 0.14);
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.panel-lead {
  margin: 7px 0 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.6;
}

.count-badge {
  display: grid;
  min-width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 800;
}

.panel-action-row {
  display: flex;
  justify-content: flex-start;
  margin: -6px 0 16px;
}

.stack-list,
.project-grid,
.project-directory-grid {
  display: grid;
  gap: 12px;
}

.list-card,
.project-card,
.project-directory-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.list-card p,
.project-card p,
.project-directory-card p {
  margin: 7px 0 0;
  color: var(--muted);
}

.text-preserve-breaks {
  white-space: pre-wrap;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.tag-row span,
.project-card-head strong {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 0.78rem;
  font-weight: 800;
}

.reward {
  display: block;
  margin-top: 14px;
}

.wallet-visual {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  padding: 20px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.14), rgba(224, 168, 59, 0.2));
}

.wallet-visual span {
  color: var(--muted);
  font-weight: 800;
}

.wallet-visual strong {
  font-size: 2rem;
}

.detail-list {
  display: grid;
  gap: 11px;
  margin: 0;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.detail-row dt {
  color: var(--muted);
}

.detail-row dd {
  margin: 0;
  text-align: right;
  font-weight: 800;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f8f5;
}

.segmented button {
  min-width: 80px;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.segmented button.is-active {
  color: #fff;
  background: var(--accent);
}

.project-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.plan-card {
  display: grid;
  gap: 14px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.plan-card.is-current {
  border-color: rgba(15, 118, 110, 0.46);
  background: linear-gradient(180deg, rgba(219, 238, 233, 0.7), #fff 42%);
}

.plan-card h3 {
  margin: 0;
  letter-spacing: 0;
}

.plan-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.plan-role {
  color: var(--accent-dark) !important;
  font-weight: 800;
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.plan-price strong {
  font-size: 1.5rem;
}

.plan-fee {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text) !important;
  background: var(--surface-muted);
  font-weight: 800;
}

.plan-actions {
  display: grid;
  gap: 8px;
}

.plan-actions button {
  display: grid;
  gap: 2px;
  text-align: left;
}

.plan-actions button span {
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0.9;
}

.plan-action-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.5;
}

.membership-checkout-message {
  margin-bottom: 14px;
}

.plain-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.plain-list li {
  position: relative;
  padding-left: 16px;
  color: var(--muted);
  line-height: 1.6;
}

.plain-list li::before {
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.three-column,
.two-column {
  display: grid;
  gap: 12px;
}

.three-column {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-column section,
.info-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.three-column h3,
.info-card h3 {
  margin: 0;
  letter-spacing: 0;
}

.three-column p,
.info-card p,
.notice-text {
  color: var(--muted);
  line-height: 1.7;
}

.info-card strong {
  display: block;
  margin-top: 12px;
}

.step-list {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.step-list li {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 3px 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.step-list span {
  grid-row: span 2;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
}

.step-list strong {
  align-self: end;
}

.step-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.notice-text {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-left: 4px solid var(--warm);
  background: rgba(180, 95, 67, 0.09);
}

.project-card-head,
.project-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-card-head span,
.project-meta {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.project-card h3 {
  margin-top: 12px;
}

.project-directory-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.project-directory-card {
  display: grid;
  gap: 12px;
  align-content: start;
}

.project-directory-card h3 {
  margin-top: 4px;
}

.project-directory-card p {
  line-height: 1.7;
}

.project-apply-button {
  margin-top: 4px;
  width: 100%;
}

.progress-track {
  height: 9px;
  margin: 18px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8e4;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.task-list,
.post-list,
.activity-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.task-item label {
  display: flex;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.task-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.task-item strong,
.task-item small {
  display: block;
}

.task-item small {
  margin-top: 4px;
  color: var(--muted);
}

.task-item.is-done strong {
  text-decoration: line-through;
}

.post-form {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.post-form textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  background: #fff;
}

.profile-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.profile-form label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 800;
}

.profile-form input,
.profile-form select {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
}

.profile-form input[readonly] {
  color: var(--muted);
  background: var(--surface-muted);
}

.profile-form small {
  color: var(--muted);
  font-weight: 700;
}

.auth-consent {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.auth-consent input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.auth-consent strong,
.auth-consent small {
  display: block;
}

.auth-consent small {
  margin-top: 4px;
  line-height: 1.55;
}

.password-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.password-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-wide,
.form-actions {
  grid-column: 1 / -1;
}

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

.post-item {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.member-list {
  display: grid;
  gap: 8px;
}

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

.announcement-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.announcement-item div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.announcement-item h3,
.announcement-item p {
  margin: 0;
}

.announcement-item time {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.announcement-item p {
  color: var(--muted);
  line-height: 1.65;
}

.member-card {
  display: grid;
  gap: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.member-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  padding: 12px 14px;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.member-card-head:hover,
.member-card-head:focus-visible,
.member-card.is-open .member-card-head {
  background: rgba(219, 238, 233, 0.45);
}

.member-card-head h3,
.member-card-head p {
  margin: 0;
}

.member-card-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.member-card-head strong {
  color: var(--accent-dark);
  font-size: 0.9rem;
  white-space: nowrap;
}

.member-plan-badge {
  display: inline-grid;
  min-height: 30px;
  place-items: center;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--accent-dark);
  background: rgba(219, 238, 233, 0.62);
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
}

.rank-number {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 34px;
  border-radius: 8px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 900;
}

.member-card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
  gap: 14px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-muted);
}

.member-card-grid[hidden] {
  display: none;
}

.post-item div,
.activity-list li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.post-item time,
.activity-list span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.post-item p,
.activity-list p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.activity-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.discussion-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.discussion-layout > .panel {
  min-width: 0;
}

.discussion-spaces-panel,
.discussion-threads-panel,
.discussion-detail-panel {
  padding: 18px;
}

.discussion-space-grid {
  display: grid;
  gap: 8px;
}

.discussion-card {
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.discussion-card.is-current,
.thread-row.is-current {
  background: rgba(219, 238, 233, 0.45);
}

.thread-row.is-unread {
  border-left: 4px solid var(--accent);
  background: rgba(219, 238, 233, 0.62);
}

.discussion-space-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.discussion-card.is-current .discussion-space-button {
  color: var(--accent-dark);
}

.discussion-space-button strong {
  overflow: hidden;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discussion-space-button small {
  align-self: end;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.discussion-body {
  margin: 0 0 14px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.75;
  white-space: pre-wrap;
}

.discussion-card-footer,
.pagination-actions,
.comment-form-actions,
.moderation-actions,
.thread-detail-actions,
.thread-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.thread-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  flex-wrap: wrap;
  justify-content: flex-end;
}

.discussion-card-footer {
  justify-content: space-between;
}

.thread-list {
  display: grid;
  gap: 6px;
}

.thread-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 10px;
  background: transparent;
}

.thread-row button {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.thread-row strong {
  min-width: 0;
  overflow: hidden;
  font-size: 0.98rem;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-row .thread-status-pill {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 0.7rem;
  font-weight: 800;
}

.thread-row.is-unread .thread-status-pill,
.unread-label {
  color: #fff;
  background: var(--accent-dark);
}

.thread-row.is-unread strong {
  font-weight: 900;
}

.thread-row button small,
.comment-item time,
.attachment-list span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.thread-row button small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.pagination-actions {
  justify-content: center;
  margin-top: 14px;
}

.comment-list {
  display: grid;
  gap: 4px;
  padding: 0;
  margin: 10px 0;
  list-style: none;
}

.comment-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.comment-item.is-unread {
  border-left: 4px solid var(--accent);
  padding-left: 10px;
  background: rgba(219, 238, 233, 0.35);
}

.comment-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 0.84rem;
  font-weight: 900;
}

.comment-content {
  min-width: 0;
}

.comment-item header,
.attachment-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.comment-meta {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.comment-delete-button {
  min-height: 28px;
  border: 1px solid rgba(180, 95, 67, 0.28);
  border-radius: 8px;
  padding: 4px 8px;
  color: var(--warm);
  background: rgba(180, 95, 67, 0.08);
  font-size: 0.76rem;
  font-weight: 900;
}

.comment-delete-button:hover,
.comment-delete-button:focus-visible {
  border-color: rgba(180, 95, 67, 0.48);
  background: rgba(180, 95, 67, 0.14);
}

.comment-reply-button,
.comment-more-button {
  margin-top: 10px;
}

.comment-reply-button {
  min-height: 30px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 8px;
  padding: 5px 9px;
  color: var(--accent-dark);
  background: rgba(219, 238, 233, 0.42);
  font-size: 0.76rem;
  font-weight: 900;
}

.comment-reply-button:hover,
.comment-reply-button:focus-visible {
  border-color: rgba(15, 118, 110, 0.42);
  background: var(--accent-soft);
}

.comment-reply-group {
  margin: -2px 0 8px 44px;
  padding-left: 14px;
  border-left: 2px solid rgba(15, 118, 110, 0.16);
  list-style: none;
}

.comment-reply-list {
  display: grid;
  gap: 2px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.comment-reply-item {
  grid-template-columns: 30px minmax(0, 1fr);
  padding: 10px 0;
}

.comment-reply-item .comment-avatar {
  width: 30px;
  height: 30px;
  font-size: 0.78rem;
}

.comment-reply-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.comment-reply-form textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--text);
  background: #fff;
}

.comment-reply-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.unread-label {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
}

.comment-item p {
  margin: 6px 0 0;
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap;
}

.comment-view-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.comment-view-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--accent-dark);
  background: #fff;
  font-size: 0.78rem;
  font-weight: 900;
}

.comment-view-button span {
  display: grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-size: 0.72rem;
}

.comment-view-button.is-viewed {
  border-color: rgba(15, 118, 110, 0.45);
  background: var(--accent-soft);
}

.comment-view-button:hover,
.comment-view-button:focus-visible {
  border-color: rgba(15, 118, 110, 0.55);
  background: rgba(219, 238, 233, 0.64);
}

.comment-view-button:disabled {
  cursor: default;
  opacity: 0.64;
}

.comment-view-list {
  min-width: min(100%, 220px);
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
}

.comment-view-list strong {
  display: block;
  margin-bottom: 3px;
  color: var(--accent-dark);
}

.comment-view-list p {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

.comment-view-panel.is-owner-visible .comment-view-button {
  border-color: rgba(180, 95, 67, 0.32);
  color: var(--warm);
  background: rgba(180, 95, 67, 0.08);
}

.comment-view-panel.is-owner-visible .comment-view-button span {
  background: var(--warm);
}

.comment-view-panel.is-owner-visible .comment-view-list {
  border-color: rgba(180, 95, 67, 0.22);
  background: rgba(180, 95, 67, 0.08);
}

.comment-view-panel.is-owner-visible .comment-view-list strong {
  color: var(--warm);
}

.attachment-list {
  display: grid;
  gap: 6px;
  padding: 10px 0 0;
  margin: 10px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.attachment-list a {
  color: var(--accent-dark);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.link-action-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 0;
}

.discussion-body + .link-action-list {
  margin: -6px 0 14px;
}

.link-action-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 36px;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 900;
  text-decoration: none;
}

.link-action-button small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.comment-form textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  background: #fff;
}

.thread-create-form {
  display: grid;
  grid-template-columns: minmax(0, 720px);
  justify-content: start;
  gap: 13px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
}

.thread-create-form label,
.thread-create-form .check-row {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 800;
}

.thread-create-form input,
.thread-create-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
}

.thread-create-form textarea {
  resize: vertical;
}

.thread-create-form .check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: 560px;
}

.thread-create-form .check-row input {
  flex: 0 0 auto;
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.thread-create-form .check-row strong,
.thread-create-form .check-row small {
  display: block;
}

.thread-create-form .check-row small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.55;
}

.form-message {
  min-height: 1.4em;
  margin: 0;
  color: var(--warm);
  font-weight: 800;
  line-height: 1.5;
}

.comment-form-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.comment-form-actions input {
  max-width: 320px;
}

.file-preview-list {
  display: grid;
  gap: 7px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.file-preview-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.file-preview-list span {
  overflow-wrap: anywhere;
  font-weight: 800;
}

.file-preview-list strong {
  color: var(--muted);
  font-size: 0.82rem;
}

.auth-panel[hidden],
.login-form[hidden],
.thread-create-form[hidden],
.moderation-actions[hidden],
#comment-form[hidden],
#create-thread-button[hidden],
#load-more-threads[hidden],
#load-more-comments[hidden] {
  display: none;
}

.discussion-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.discussion-status strong {
  color: var(--accent-dark);
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    z-index: 20;
    height: auto;
    padding: 12px 16px 0;
    border-right: 0;
    background: transparent;
  }

  .brand {
    width: fit-content;
  }

  .side-nav {
    position: fixed;
    right: 6px;
    bottom: calc(6px + env(safe-area-inset-bottom));
    left: 6px;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2px;
    margin: 0;
    padding: 5px;
    border: 1px solid rgba(32, 48, 56, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 16px 36px rgba(30, 48, 56, 0.18);
    backdrop-filter: blur(16px);
  }

  .side-nav a {
    display: grid;
    grid-template-rows: 20px 12px;
    min-width: 0;
    min-height: 48px;
    place-items: center;
    gap: 2px;
    padding: 5px 2px;
    border-radius: 7px;
    color: #6b777c;
    line-height: 1;
  }

  .side-nav a:hover,
  .side-nav a.is-current {
    color: var(--accent-dark);
    background: rgba(219, 238, 233, 0.9);
  }

  .side-nav a.is-current .nav-icon {
    transform: translateY(-1px);
  }

  .nav-label-desktop {
    display: none;
  }

  .nav-label-mobile {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    font-size: 0.58rem;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: keep-all;
  }

  .nav-icon {
    position: relative;
    display: block;
    width: 20px;
    height: 20px;
    color: currentColor;
    transition: transform 160ms ease;
  }

  .nav-icon::before,
  .nav-icon::after {
    position: absolute;
    content: "";
    box-sizing: border-box;
  }

  .nav-icon-home::before {
    top: 4px;
    left: 5px;
    width: 12px;
    height: 12px;
    border-top: 2px solid currentColor;
    border-left: 2px solid currentColor;
    transform: rotate(45deg);
  }

  .nav-icon-home::after {
    right: 5px;
    bottom: 3px;
    left: 5px;
    height: 10px;
    border: 2px solid currentColor;
    border-top: 0;
    border-radius: 0 0 4px 4px;
  }

  .nav-icon-card::before {
    inset: 4px 2px;
    border: 2px solid currentColor;
    border-radius: 5px;
  }

  .nav-icon-card::after {
    top: 9px;
    right: 5px;
    left: 5px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
  }

  .nav-icon-chat::before {
    inset: 4px 2px 5px;
    border: 2px solid currentColor;
    border-radius: 6px;
  }

  .nav-icon-chat::after {
    bottom: 3px;
    left: 8px;
    width: 7px;
    height: 7px;
    border-bottom: 2px solid currentColor;
    border-left: 2px solid currentColor;
    transform: rotate(-20deg);
  }

  .nav-icon-projects::before {
    top: 6px;
    right: 2px;
    bottom: 3px;
    left: 2px;
    border: 2px solid currentColor;
    border-radius: 3px;
  }

  .nav-icon-projects::after {
    top: 3px;
    left: 4px;
    width: 7px;
    height: 5px;
    border: 2px solid currentColor;
    border-bottom: 0;
    border-radius: 3px 3px 0 0;
  }

  .nav-icon-members::before {
    top: 3px;
    left: 7px;
    width: 8px;
    height: 8px;
    border: 2px solid currentColor;
    border-radius: 50%;
    box-shadow:
      -7px 4px 0 -2px currentColor,
      7px 4px 0 -2px currentColor;
  }

  .nav-icon-members::after {
    right: 3px;
    bottom: 4px;
    left: 3px;
    height: 8px;
    border: 2px solid currentColor;
    border-radius: 10px 10px 4px 4px;
  }

  .nav-icon-user::before {
    top: 3px;
    left: 7px;
    width: 8px;
    height: 8px;
    border: 2px solid currentColor;
    border-radius: 50%;
  }

  .nav-icon-user::after {
    right: 4px;
    bottom: 4px;
    left: 4px;
    height: 9px;
    border: 2px solid currentColor;
    border-radius: 10px 10px 4px 4px;
  }

  .main {
    width: min(100%, 760px);
    padding: 20px 16px calc(112px + env(safe-area-inset-bottom));
  }

  .overview-grid,
  .hero-panel,
  .content-grid,
  .project-grid,
  .project-directory-grid,
  .plan-grid,
  .member-card-grid,
  .three-column,
  .two-column {
    grid-template-columns: 1fr;
  }

  .mini-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 380px) {
  .side-nav {
    right: 4px;
    left: 4px;
    gap: 1px;
    padding: 4px;
  }

  .side-nav a {
    min-height: 45px;
    padding: 4px 1px;
  }

  .nav-label-mobile {
    font-size: 0.54rem;
  }

  .nav-icon {
    width: 19px;
    height: 19px;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 16px 12px calc(112px + env(safe-area-inset-bottom));
  }

  .discussion-layout {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .discussion-spaces-panel,
  .discussion-threads-panel,
  .discussion-detail-panel {
    padding: 14px;
  }

  .discussion-space-grid {
    display: grid;
    gap: 7px;
  }

  .discussion-space-button {
    min-width: 0;
    padding: 11px;
  }

  .thread-row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px 0;
  }

  .thread-meta {
    min-width: 54px;
  }

  .thread-detail-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .comment-form {
    margin-right: -14px;
    margin-left: -14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-right: 0;
    border-left: 0;
    background: rgba(248, 250, 247, 0.96);
  }
}

@media (max-width: 640px) {
  .topbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-head > .build-badge,
  .panel-head-actions {
    align-self: flex-start;
  }

  .profile-chip {
    min-width: 0;
  }

  .account-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .mini-metrics {
    grid-template-columns: 1fr;
  }

  .detail-row,
  .announcement-item div,
  .member-card-head,
  .post-item div,
  .activity-list li,
  .discussion-status,
  .comment-item header,
  .attachment-list li,
  .comment-reply-actions {
    flex-direction: column;
  }

  .comment-reply-group {
    margin-left: 20px;
    padding-left: 10px;
  }

  .thread-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-row dd {
    text-align: left;
  }

  .profile-form {
    grid-template-columns: 1fr;
  }

  .password-fields {
    grid-template-columns: 1fr;
  }

  .thread-create-form {
    grid-template-columns: 1fr;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions button {
    flex: 1;
  }

  .comment-form-actions {
    align-items: stretch;
  }

  .comment-form-actions input,
  .comment-form-actions button {
    width: 100%;
    max-width: none;
  }
}
