:root {
  --ink: #17130f;
  --paper: #fffdf8;
  --soft: #f4efe6;
  --line: #ded4c2;
  --muted: #6f665b;
  --gold: #8a651c;
  --green: #2f5f50;
  --red: #8f2d2d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
}

.shell {
  width: min(1200px, calc(100% - 36px));
  margin: 0 auto;
  padding: 30px 0 72px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
}

.topbar nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
}

.topbar a,
.inline-form button {
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  text-decoration: none;
}

.topbar a.top-action {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(47, 95, 80, 0.45);
  background: #f2f6f1;
  color: var(--green);
  font-weight: 700;
}

.back-row {
  margin-top: 22px;
}

.back-row a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.to-top-button {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.to-top-button.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.inline-form {
  display: inline;
  margin: 0;
}

.inline-form button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.inline-form .logout-button {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.hero-block {
  max-width: 860px;
  padding: clamp(44px, 7vw, 82px) 0 30px;
}

.hero-block.compact {
  padding-bottom: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(2.3rem, 7vw, 5rem);
  line-height: 0.96;
  font-weight: 400;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(1.3rem, 3vw, 2rem);
  line-height: 1.1;
}

h3 {
  margin-bottom: 10px;
  font-size: 1rem;
}

p {
  color: var(--muted);
}

.two-column,
.dashboard-grid,
.content-grid,
.admin-layout,
.metrics {
  display: grid;
  gap: 16px;
}

.two-column {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

.dashboard-grid,
.content-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.admin-layout {
  grid-template-columns: 280px minmax(0, 1fr) 280px;
  align-items: start;
}

.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.panel,
.metric,
.notice {
  border: 1px solid var(--line);
  background: #fffaf1;
}

.panel {
  padding: clamp(20px, 3vw, 28px);
}

.muted-panel {
  background: var(--soft);
}

.narrow {
  max-width: 540px;
}

.auth-hero {
  max-width: 680px;
  padding-bottom: 16px;
}

.auth-panel {
  max-width: 560px;
  margin-bottom: 24px;
}

.register-note {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.register-note strong {
  display: block;
  margin-bottom: 8px;
}

.register-note p {
  margin-bottom: 14px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.button-link.strong {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.access-grid,
.partner-dashboard {
  display: grid;
  gap: 16px;
}

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

.dashboard-access {
  margin-bottom: 22px;
}

.access-card {
  display: flex;
  min-height: 320px;
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid var(--line);
  background: #fffaf1;
  flex-direction: column;
  justify-content: space-between;
}

.access-card.partner,
.partner-highlight {
  background: #f2f6f1;
  border-color: rgba(47, 95, 80, 0.35);
}

.access-card h2,
.partner-highlight h2 {
  max-width: 620px;
}

.access-card ul {
  margin: 18px 0 22px;
  padding-left: 18px;
  color: var(--muted);
}

.access-card li + li {
  margin-top: 6px;
}

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

.partner-dashboard .partner-highlight {
  grid-column: 1 / -1;
}

.creator-question-area {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  max-width: 920px;
  margin-top: 16px;
}

.private-answer {
  margin-top: 14px;
  padding: 14px;
  border-left: 4px solid var(--green);
  background: #f2f6f1;
}

.private-answer p {
  margin-bottom: 0;
  color: var(--ink);
}

.profile-gate,
.profile-hints {
  border-color: rgba(138, 101, 28, 0.35);
  background: #fff8e8;
}

.profile-hints {
  margin-bottom: 18px;
  padding: 14px;
}

.profile-hints p {
  margin-bottom: 8px;
}

.profile-hints p:last-child {
  margin-bottom: 0;
}

.profile-status {
  margin: 12px 0 18px;
  font-size: 0.9rem;
  font-weight: 700;
}

.profile-status.complete {
  color: var(--green);
}

.profile-status.missing {
  color: var(--gold);
}

.registration-panel {
  max-width: 920px;
}

.form-head {
  max-width: 720px;
  margin-bottom: 22px;
}

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

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

.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.form-actions a {
  color: var(--muted);
}

.metric {
  padding: 20px;
}

.metric strong {
  display: block;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
  font-weight: 400;
}

.metric span,
.small,
.list-item span,
.user-row span,
.activity-row span,
.message time {
  color: var(--muted);
  font-size: 0.88rem;
}

.notice {
  margin-top: 22px;
  padding: 14px 16px;
}

.notice.success {
  border-color: rgba(47, 95, 80, 0.45);
  background: #edf4ef;
}

.notice.error {
  border-color: rgba(143, 45, 45, 0.45);
  background: #f8eeee;
}

.danger-panel {
  max-width: 920px;
  margin-top: 18px;
  border-color: rgba(143, 45, 45, 0.5);
  background: #fff4f1;
}

.danger-panel .eyebrow {
  color: var(--red);
}

.danger-button {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.export-download-form {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.data-export-preview {
  max-height: 620px;
  overflow: auto;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: 0.9rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.stack {
  display: grid;
  gap: 14px;
}

.compact-form {
  gap: 8px;
  margin-top: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
}

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

input,
textarea,
select {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
}

textarea {
  resize: vertical;
}

button,
.quick-links a,
.tabs a {
  display: inline-flex;
  justify-content: center;
  width: fit-content;
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  cursor: pointer;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.logout-panel-form {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.logout-panel-form button {
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
}

.quick-links a,
.tabs a {
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.tabs a.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.tabs a.member-dashboard-link {
  margin-left: auto;
  border-color: rgba(47, 95, 80, 0.45);
  background: #f2f6f1;
  color: var(--green);
}

dl {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 8px 14px;
  margin: 0;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
}

.detail-list {
  margin-bottom: 24px;
  padding: 18px;
  background: var(--soft);
}

.article-preview,
.list-item,
.message,
.initial-message {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.article-list-wrap {
  max-width: 920px;
}

.article-list-panel > h2 {
  margin-bottom: 22px;
}

.article-preview {
  padding: clamp(18px, 3vw, 26px);
}

.article-preview h3 {
  font-size: clamp(1.2rem, 2.4vw, 1.65rem);
}

.article-preview span,
.list-item span {
  display: block;
}

.article-details {
  margin-top: 16px;
}

.read-aloud-button {
  margin-top: 10px;
  min-height: 36px;
  padding: 8px 13px;
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
}

.read-aloud-button.is-reading {
  border-color: rgba(47, 95, 80, 0.45);
  background: #f2f6f1;
  color: var(--green);
}

.article-details summary {
  display: inline-flex;
  width: fit-content;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.article-details summary::-webkit-details-marker {
  display: none;
}

.article-body {
  margin-top: 18px;
  color: var(--ink);
}

.article-details .details-close {
  margin-top: 16px;
}

.message.admin {
  border-color: rgba(47, 95, 80, 0.35);
  background: #f2f6f1;
}

.message strong,
.message time {
  display: block;
}

.message p,
.list-item p {
  margin: 10px 0 0;
  color: var(--ink);
}

.link-item,
.user-row,
.activity-row {
  display: block;
  color: inherit;
  text-decoration: none;
}

.user-list,
.activity-list {
  padding: 16px;
}

.user-row,
.activity-row {
  padding: 12px;
  border-top: 1px solid var(--line);
}

.user-row.active,
.user-row:hover,
.activity-row:hover,
.link-item:hover {
  background: var(--soft);
}

.user-row strong,
.user-row span,
.user-row em,
.activity-row strong,
.activity-row span {
  display: block;
}

.user-row em {
  margin-top: 5px;
  color: var(--gold);
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 700;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.detail-head p {
  margin-bottom: 0;
}

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

.actions form {
  margin: 0;
}

.actions button,
.compact-form button {
  min-height: 36px;
  padding: 8px 12px;
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
}

.reply-form {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

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

  .activity-list {
    grid-column: 1 / -1;
  }
}

@media (max-width: 780px) {
  .topbar,
  .detail-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar nav,
  .actions {
    justify-content: flex-start;
  }

  .two-column,
  .dashboard-grid,
  .content-grid,
  .admin-layout,
  .metrics,
  .access-grid,
  .creator-question-area,
  .partner-dashboard,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .access-card {
    min-height: auto;
  }

  dl {
    grid-template-columns: 1fr;
  }
}
