:root {
  --bg: #f6f7f2;
  --text: #1c2321;
  --muted: #63706a;
  --line: #d8ded5;
  --primary: #246b57;
  --primary-dark: #174b3d;
  --accent: #d87c4a;
  --card: #ffffff;
  --soft: #eaf1ea;
  --shadow: 0 18px 45px rgba(30, 48, 41, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(246, 247, 242, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.nav {
  width: min(1120px, calc(100% - 32px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand,
.nav-links,
.hero-actions,
.tabs {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-size: 0.9rem;
}

.nav-links {
  gap: 22px;
  color: var(--muted);
  font-weight: 700;
}

.nav-links a:hover {
  color: var(--primary);
}

.hero {
  width: min(1120px, calc(100% - 32px));
  min-height: 570px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  align-items: center;
  gap: 36px;
  padding: 58px 0 42px;
}

.hero-content h1,
.section-heading h2,
.auth-copy h2 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

.hero-content h1 {
  max-width: 720px;
  font-size: clamp(2.3rem, 6vw, 4.8rem);
}

.hero-text {
  max-width: 640px;
  color: var(--muted);
  font-size: 1.1rem;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.primary-button,
.secondary-button,
.ghost-button,
.tab {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
}

.primary-button {
  background: var(--primary);
  color: white;
}

.primary-button:hover {
  background: var(--primary-dark);
}

.secondary-button,
.ghost-button {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.full {
  width: 100%;
}

.hero-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 24px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(36, 107, 87, 0.95), rgba(21, 52, 64, 0.94)),
    url("https://images.unsplash.com/photo-1519682337058-a94d519337bc?auto=format&fit=crop&w=900&q=80");
  background-size: cover;
  color: white;
  box-shadow: var(--shadow);
}

.stat {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: end;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
}

.stat strong {
  font-size: 2rem;
}

.stat span {
  opacity: 0.86;
}

.section {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 70px 0;
}

.section-heading {
  margin-bottom: 28px;
}

.section-heading h2,
.auth-copy h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.book-card,
.auth-card,
.members-card,
.composer-card,
.profile-preview-card,
.profile-form,
.database-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.book-card {
  padding: 20px;
  display: flex;
  min-height: 100%;
  flex-direction: column;
}

.book-card h3 {
  margin: 18px 0 8px;
}

.book-card p,
.auth-copy p {
  color: var(--muted);
}

.book-cover {
  width: 100%;
  height: 280px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--line);
}

.events {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.timeline div {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border-radius: 8px;
  background: var(--soft);
}

.timeline strong {
  color: var(--primary);
}

.auth-section {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 0.75fr);
  align-items: start;
  gap: 32px;
}

.welcome-box {
  margin-top: 22px;
  padding: 18px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--primary-dark);
  font-weight: 800;
}

.auth-card {
  padding: 22px;
}

.tabs {
  gap: 8px;
  padding: 6px;
  border-radius: 8px;
  background: var(--soft);
}

.tab {
  flex: 1;
  background: transparent;
  color: var(--muted);
}

.tab.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: 0 6px 16px rgba(30, 48, 41, 0.1);
}

.auth-form {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.auth-form label {
  color: var(--text);
  font-weight: 800;
}

.auth-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  font: inherit;
}

textarea {
  width: 100%;
  min-height: 110px;
  padding: 12px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  font: inherit;
}

textarea:focus {
  outline: 3px solid rgba(36, 107, 87, 0.18);
  border-color: var(--primary);
}

.feed-section {
  border-bottom: 1px solid var(--line);
}

.feed-layout {
  display: grid;
  gap: 18px;
}

.composer-card,
.profile-preview-card,
.profile-form {
  padding: 22px;
}

.composer-top {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 700;
}

.feed-list {
  display: grid;
  gap: 14px;
}

.post-card,
.empty-feed {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  padding: 18px;
}

.empty-feed {
  color: var(--muted);
  text-align: center;
}

.post-header {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
}

.post-header strong,
.post-body {
  overflow-wrap: anywhere;
}

.post-meta,
.reply-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.post-body {
  margin: 14px 0;
}

.post-actions,
.reply-form {
  display: flex;
  gap: 10px;
}

.icon-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.replies {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-left: 60px;
}

.reply-card {
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
}

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

.reply-form input {
  flex: 1;
  min-width: 0;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.6fr) minmax(320px, 1fr);
  gap: 22px;
}

.profile-preview-card {
  text-align: center;
}

.profile-preview-card h3 {
  margin: 14px 0 8px;
}

.profile-preview-card p {
  color: var(--muted);
}

.profile-details {
  display: grid;
  gap: 12px;
  margin: 22px 0 0;
  text-align: left;
}

.profile-details div {
  padding: 14px;
  border-radius: 8px;
  background: var(--soft);
}

.profile-details dt {
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.profile-details dd {
  margin: 4px 0 0;
}

.profile-form {
  display: grid;
  gap: 10px;
}

.profile-form label {
  font-weight: 800;
}

.profile-form input,
.reply-form input {
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  font: inherit;
}

.avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 900;
}

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

.avatar.small {
  width: 52px;
  height: 52px;
}

.avatar.large {
  width: 128px;
  height: 128px;
  margin: 0 auto;
  font-size: 2rem;
}

.auth-form input:focus {
  outline: 3px solid rgba(36, 107, 87, 0.18);
  border-color: var(--primary);
}

.message {
  min-height: 24px;
  margin: 16px 0 0;
  color: var(--primary);
  font-weight: 800;
}

.message.error {
  color: #b83d36;
}

.members-section {
  padding-top: 34px;
}

.members-card {
  overflow: hidden;
}

.members-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 20px 22px;
  background: var(--soft);
  color: var(--primary-dark);
}

.members-summary strong {
  font-size: 2.3rem;
  line-height: 1;
}

.members-summary span {
  font-weight: 800;
}

.members-table-wrap {
  overflow-x: auto;
}

.members-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.members-table th,
.members-table td {
  vertical-align: middle;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}

.members-table th {
  color: var(--primary);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.members-note {
  margin: 0;
  padding: 16px 22px 20px;
  color: var(--muted);
}

.member-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
  font-weight: 800;
}

.database-section {
  padding-top: 34px;
}

.database-card {
  padding: 22px;
}

.database-status {
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--primary-dark);
  font-weight: 800;
}

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

.database-grid article {
  min-width: 0;
}

.database-grid h3 {
  margin: 0 0 10px;
}

.database-grid pre {
  min-height: 220px;
  max-height: 360px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border-radius: 8px;
  background: #18221f;
  color: #eaf1ea;
  font-size: 0.86rem;
  white-space: pre-wrap;
}

.database-help {
  margin: 16px 0 0;
  color: var(--muted);
}

.hidden {
  display: none;
}

.admin-only {
  display: none;
}

.footer {
  padding: 24px 16px 36px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 760px) {
  .nav {
    min-height: auto;
    padding: 14px 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.92rem;
  }

  .hero,
  .auth-section,
  .profile-grid,
  .database-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 42px;
  }

  .hero-panel,
  .book-grid,
  .timeline {
    grid-template-columns: 1fr;
  }

  .composer-top {
    grid-template-columns: 1fr;
  }

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

  .replies {
    padding-left: 0;
  }

  .stat {
    min-height: 92px;
  }
}
