:root {
  --ink: #0f1419;
  --muted: #536471;
  --line: #d6d9db;
  --soft-line: #eff3f4;
  --surface: #ffffff;
  --page: #f7f8f8;
  --soft: #f7f9f9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 92%);
  padding: 12px clamp(16px, 4vw, 32px);
  backdrop-filter: blur(16px);
}

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

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

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-size: 14px;
  font-weight: 850;
}

.brand-logo {
  display: block;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--ink);
  object-fit: cover;
}

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

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

.beta-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 16px clamp(16px, 4vw, 32px) 40px;
}

.setup-shell {
  display: grid;
  width: min(900px, 100%);
  margin: 0 auto;
  gap: 16px;
  padding: 24px clamp(16px, 4vw, 32px) 48px;
}

.setup-intro {
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

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

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  padding: 26px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  font-size: clamp(34px, 5vw, 58px);
  letter-spacing: 0;
  line-height: 1.02;
}

h2 {
  font-size: 18px;
}

.hero-copy {
  max-width: 650px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.key-card {
  display: grid;
  gap: 8px;
  align-content: start;
  border: 1px solid #cfd9de;
  border-radius: 8px;
  background: var(--soft);
  padding: 14px;
}

.key-card code {
  border-radius: 6px;
  background: white;
  padding: 8px;
  font-size: 12px;
}

.auth-grid,
.dashboard,
.app-shell,
.roadmap-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

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

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

.dashboard {
  grid-template-columns: 270px minmax(0, 1fr) 320px;
}

.app-shell {
  grid-template-columns: 270px minmax(0, 1fr) 320px;
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 16px clamp(16px, 4vw, 32px) 40px;
}

.left-rail,
.right-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.community-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.community-button {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  padding: 12px;
  text-align: left;
}

.community-button:hover,
.community-button.active {
  border-color: #cfd9de;
  background: #f7f9f9;
}

.community-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 850;
}

.dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 999px;
}

.community-meta {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.composer {
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.locked-composer {
  display: grid;
  gap: 10px;
  background: #fbfcf8;
}

.locked-composer p {
  color: var(--muted);
}

.panel,
.community-form,
.posts-section {
  padding: 16px;
}

.roadmap-card {
  display: grid;
  gap: 12px;
}

.roadmap-card p,
.roadmap-card li,
.roadmap-notes p {
  color: var(--muted);
  line-height: 1.55;
}

.roadmap-card ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.timeline {
  display: block;
  border-top: 1px solid var(--soft-line);
  padding-top: 12px;
}

.roadmap-notes {
  margin-top: 16px;
}

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

.note-grid p {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.form-panel,
.community-form,
.compact-panel,
.credential-panel {
  display: grid;
  gap: 14px;
}

.standalone-form {
  padding: 22px;
}

.credential-panel {
  margin-top: 16px;
}

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

.credential-grid input[readonly] {
  background: white;
  font-weight: 800;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.check-row input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

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

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cfd9de;
  border-radius: 8px;
  outline: 0;
  background: var(--soft);
  color: var(--ink);
  padding: 11px 12px;
  font-size: 15px;
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: var(--ink);
  background: white;
}

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

.connect-button,
.post-button {
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  padding: 10px 18px;
  font-weight: 800;
}

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

.secondary-button,
.secondary-link {
  border: 1px solid #cfd9de;
  border-radius: 999px;
  background: white;
  color: var(--ink);
  padding: 9px 14px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
}

.store-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: white;
  padding: 9px 14px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 850;
}

.store-link:hover {
  background: #2b3035;
}

.full-link {
  width: 100%;
  margin-top: 12px;
  text-align: center;
}

.post-button:hover,
.connect-button:hover {
  background: #2b3035;
}

.secondary-button:hover,
.secondary-link:hover {
  background: #eef3f5;
}

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

.muted,
.compact-panel p,
.community-tone {
  color: var(--muted);
}

.community-tone {
  margin-top: 8px;
}

.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.metric-row span,
.tag {
  border-radius: 999px;
  background: #eef3f5;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.feed {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
}

.post {
  border-bottom: 1px solid var(--soft-line);
  background: white;
  padding: 16px;
}

.post:last-child {
  border-bottom: 0;
}

.post.is-hidden {
  opacity: 0.56;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.post-meta span {
  color: var(--muted);
  font-size: 13px;
}

.post-link {
  display: block;
  margin-top: 8px;
  color: #1d78a8;
  overflow-wrap: anywhere;
  text-decoration: none;
  font-size: 14px;
}

.post-body {
  margin-top: 8px;
  color: var(--ink);
  line-height: 1.65;
}

.post-actions {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}

.post-actions button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 14px;
}

.post-actions button:hover {
  color: var(--ink);
}

.sponsored-post {
  background: #fbfcf8;
}

.sponsored-label {
  display: inline-flex;
  margin-bottom: 10px;
  border: 1px solid #d8dfb8;
  border-radius: 999px;
  background: #f4f7df;
  color: #53610f;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
}

.empty {
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.status-line {
  min-height: 24px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.status-line[data-tone="success"] {
  color: #007a4d;
}

.status-line[data-tone="error"] {
  color: #c23b22;
}

.admin-surface {
  display: grid;
  gap: 16px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.admin-stat {
  display: grid;
  gap: 4px;
}

.admin-stat strong {
  font-size: 28px;
}

.admin-stat span,
.admin-card-head span,
.admin-log span {
  color: var(--muted);
  font-size: 13px;
}

.admin-panel {
  display: grid;
  gap: 12px;
}

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

.admin-card,
.admin-log {
  display: grid;
  gap: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}

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

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

.danger-button {
  border: 1px solid #f0b8ad;
  border-radius: 999px;
  background: #fff5f3;
  color: #a12a16;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 800;
}

.danger-button:hover {
  background: #ffe6e0;
}

select {
  width: 100%;
  border: 1px solid #cfd9de;
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  padding: 11px 12px;
}

.admin-log code {
  overflow-wrap: anywhere;
  border-radius: 6px;
  background: var(--soft);
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}

.legal-shell {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 32px) 56px;
}

.legal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: clamp(18px, 4vw, 32px);
}

.legal-card h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.05;
}

.legal-card h2 {
  margin: 28px 0 10px;
  font-size: 18px;
}

.legal-card p,
.legal-card li {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.legal-card ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.legal-updated {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.theme-toggle {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  padding: 9px 13px;
  font-size: 14px;
  font-weight: 800;
}

.theme-toggle:hover {
  background: var(--soft-line);
}

:root[data-theme="dark"] {
  --ink: #f4f7f9;
  --muted: #9aa8b3;
  --line: #2b3540;
  --soft-line: #1d2630;
  --surface: #111820;
  --page: #090d12;
  --soft: #151f29;
  color-scheme: dark;
}

:root[data-theme="dark"] .topbar {
  background: rgb(9 13 18 / 92%);
}

:root[data-theme="dark"] .key-card,
:root[data-theme="dark"] .locked-composer,
:root[data-theme="dark"] .sponsored-post,
:root[data-theme="dark"] .legal-card,
:root[data-theme="dark"] .post {
  background: #111820;
}

:root[data-theme="dark"] .key-card code,
:root[data-theme="dark"] .credential-box,
:root[data-theme="dark"] .admin-log code {
  background: #0d141c;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select {
  border-color: var(--line);
  background: var(--soft);
  color: var(--ink);
}

:root[data-theme="dark"] input:focus,
:root[data-theme="dark"] textarea:focus {
  background: #0d141c;
}

:root[data-theme="dark"] .community-button:hover,
:root[data-theme="dark"] .community-button.active,
:root[data-theme="dark"] .secondary-button:hover,
:root[data-theme="dark"] .secondary-link:hover,
:root[data-theme="dark"] .theme-toggle:hover {
  background: var(--soft-line);
}

:root[data-theme="dark"] .secondary-button,
:root[data-theme="dark"] .secondary-link,
:root[data-theme="dark"] .theme-toggle {
  border-color: var(--line);
  background: #0d141c;
  color: var(--ink);
}

:root[data-theme="dark"] .store-link {
  border-color: #f4f7f9;
  background: #f4f7f9;
  color: #090d12;
}

:root[data-theme="dark"] .store-link:hover {
  background: #dce6ef;
}

:root[data-theme="dark"] .connect-button,
:root[data-theme="dark"] .post-button {
  color: #090d12;
}

:root[data-theme="dark"] .connect-button:hover,
:root[data-theme="dark"] .post-button:hover {
  background: #dce6ef;
}

:root[data-theme="dark"] .feed a {
  color: #7cc7ff;
}

:root[data-theme="dark"] .feed {
  border-color: var(--line);
}

:root[data-theme="dark"] .post {
  border-bottom-color: var(--line);
}

:root[data-theme="dark"] .post-link {
  color: #7cc7ff;
}

:root[data-theme="dark"] .sponsored-label,
:root[data-theme="dark"] .tag,
:root[data-theme="dark"] .metric-row span,
:root[data-theme="dark"] .x-coms-sponsored-label {
  border-color: var(--line);
  background: var(--soft);
  color: var(--muted);
}

:root[data-theme="dark"] .status-ok {
  color: #7ee0a0;
}

:root[data-theme="dark"] .status-bad,
:root[data-theme="dark"] .danger-button {
  color: #ff9b87;
}

:root[data-theme="dark"] .danger-button {
  border-color: #673229;
  background: #331a16;
}

@media (max-width: 1060px) {
  .dashboard,
  .app-shell,
  .hero-panel {
    grid-template-columns: minmax(0, 1fr);
  }

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

@media (max-width: 760px) {
  .topbar,
  .community-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-grid,
  .form-grid,
  .credential-grid,
  .admin-stats,
  .right-rail,
  .roadmap-grid,
  .note-grid {
    grid-template-columns: 1fr;
  }

  .connect-button,
  .post-button,
  .secondary-button,
  .secondary-link {
    width: 100%;
    text-align: center;
  }

  .top-actions {
    width: 100%;
    flex-direction: column;
  }
}
