:root {
  --bg: #fafafa;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #18181b;
  --muted: #71717a;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --primary: #4f46e5;
  --primary-strong: #4338ca;
  --primary-soft: #eef2ff;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --purple: #7c3aed;
  --purple-soft: #f3e8ff;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --shadow: 0 1px 2px rgba(24, 24, 27, 0.04), 0 12px 32px rgba(24, 24, 27, 0.06);
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --sidebar-width: 256px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "Segoe UI Variable", "Segoe UI", sans-serif;
}

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

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

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: var(--sidebar-width);
  padding: 16px;
  background: #fff;
  border-right: 1px solid var(--line);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 8px;
  font-size: 20px;
  font-weight: 700;
}

.sidebar-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.sidebar-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #3f3f46;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: 0.2s ease;
}

.sidebar-link:hover,
.sidebar-link:focus-visible {
  background: #f4f4f5;
  outline: none;
}

.sidebar-link.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.main-shell {
  min-width: 0;
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-left {
  flex: 1 1 auto;
  min-width: 0;
}

.topbar-right {
  justify-content: flex-end;
  flex-shrink: 0;
}

.topbar-search {
  flex: 1 1 auto;
  min-width: 0;
}

.topbar-search input {
  width: 100%;
  min-width: 240px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
}

.store-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.store-switcher select {
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}

.store-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
}

.icon-button,
.profile-button,
.menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}

.icon-button,
.menu-button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.profile-button {
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 10px;
}

.profile-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.profile-caret {
  font-size: 12px;
  color: var(--muted);
}

.menu-button {
  display: none;
  flex-direction: column;
  gap: 3px;
}

.menu-button span {
  width: 16px;
  height: 2px;
  background: var(--ink);
  border-radius: 999px;
}

.status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 24px 0;
  padding: 14px 18px;
  border: 1px solid #fde68a;
  border-radius: 14px;
  background: linear-gradient(90deg, #fffbeb, #fff7ed);
}

.status-banner-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.status-banner strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.status-banner p {
  margin: 0;
  font-size: 14px;
  color: #92400e;
}

.status-banner-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.banner-score-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  background: #fff;
  font-weight: 700;
  color: #92400e;
}

.status-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #ddd6fe;
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

.content {
  padding: 24px;
}

.page {
  display: none;
  width: 100%;
}

.page.is-active {
  display: block;
}

.page + .page {
  margin-top: 0;
}

.page-header {
  margin-bottom: 24px;
}

.page-header-with-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-header > div,
.page-header-with-actions > div:first-child,
.card-header > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.page-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.page-actions,
.toolbar-actions,
.stack-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.page-grid {
  display: grid;
  gap: 24px;
  margin-top: 24px;
  width: 100%;
}

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

.stats-grid {
  display: grid;
  gap: 24px;
}

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

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

.card,
.stat-card,
.support-panel-card,
.note-card,
.code-card,
.feed-item,
.summary-card,
.template-card,
.roadmap-card,
.governance-card,
.status-item,
.setup-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.card,
.support-panel-card,
.note-card,
.feed-item,
.summary-card,
.template-card,
.roadmap-card,
.governance-card,
.status-item,
.setup-card {
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.card-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.card-header p,
.helper-copy,
.summary-card span,
.feed-item-meta,
.feed-item-body,
.status-item p,
.template-card p,
.roadmap-card p,
.governance-card p,
.analytics-card small,
.setup-card p {
  color: var(--muted);
}

.helper-copy {
  margin: 0 0 18px;
  font-size: 14px;
}

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

.toolbar-search {
  flex: 1;
}

.toolbar-search input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: 0.2s ease;
}

.button:hover,
.button:focus-visible,
.sidebar-link:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

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

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--primary-strong);
}

.button-secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.button-ghost {
  background: var(--panel-soft);
  color: var(--ink);
  border-color: transparent;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 13px;
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.field textarea {
  min-height: 220px;
  resize: vertical;
}

.checkbox-field {
  grid-template-columns: auto 1fr;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.checkbox-field span {
  font-size: 14px;
}

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

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
}

.stat-card > div:last-child {
  min-width: 0;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

.stat-icon-indigo {
  background: #e0e7ff;
}

.stat-icon-amber {
  background: #fef3c7;
}

.stat-icon-purple {
  background: #f3e8ff;
}

.stat-icon-green {
  background: #dcfce7;
}

.stat-icon-orange {
  background: #ffedd5;
}

.stat-icon-red {
  background: #fee2e2;
}

.stat-card p {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--muted);
}

.stat-card strong {
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.feed-list,
.status-list,
.roadmap-stack,
.template-stack {
  display: grid;
  gap: 12px;
}

.feed-item strong,
.summary-card strong,
.template-card strong,
.roadmap-card strong,
.governance-card strong,
.status-item strong {
  display: block;
  margin-bottom: 4px;
}

.feed-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.navigation-card {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.navigation-card:hover,
.navigation-card:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.queue-tag,
.review-status,
.question-status,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.queue-tag.is-live,
.review-status.is-approved,
.question-status.is-published,
.pill.is-live {
  background: var(--green-soft);
  color: var(--green);
}

.question-status.is-live {
  background: var(--primary-soft);
  color: var(--primary);
}

.queue-tag.is-pending,
.review-status.is-pending,
.question-status.is-pending,
.pill.is-pending {
  background: var(--amber-soft);
  color: var(--amber);
}

.review-status.is-rejected {
  background: var(--red-soft);
  color: var(--red);
}

.feed-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.inline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.media-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.media-strip img,
.media-strip video {
  width: 88px;
  height: 88px;
  border: 1px solid var(--line);
  border-radius: 12px;
  object-fit: cover;
  background: #f4f4f5;
}

.analytics-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 30px;
  line-height: 1;
}

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

.setup-steps {
  display: grid;
  gap: 12px;
}

.analytics-card {
  display: grid;
  gap: 4px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.analytics-card .eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.empty-card {
  text-align: left;
}

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

.code-card,
.console-output {
  margin: 0;
  padding: 16px;
  border-radius: var(--radius-md);
  background: #09090b;
  color: #f4f4f5;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.55;
  overflow: auto;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
}

.support-panel {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 24, 27, 0.44);
  z-index: 40;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  min-width: 240px;
  max-width: min(90vw, 520px);
  padding: 14px 18px;
  border-radius: 999px;
  background: rgba(9, 9, 11, 0.94);
  color: #fff;
  text-align: center;
  z-index: 50;
  box-shadow: var(--shadow);
}

@media (max-width: 1200px) {
  .stats-grid-4,
  .stats-grid-3,
  .page-grid.two-columns,
  .form-grid,
  .governance-grid,
  .analytics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.24s ease;
  }

  .app-shell[data-nav-open="true"] .sidebar {
    transform: translateX(0);
  }

  .main-shell {
    margin-left: 0;
    width: 100%;
  }

  .menu-button {
    display: inline-flex;
  }
}

@media (max-width: 860px) {
  .content {
    padding: 18px;
  }

  .topbar {
    height: auto;
    padding: 14px 18px;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-left,
  .topbar-right {
    justify-content: space-between;
  }

  .topbar-search input {
    min-width: 0;
    width: 100%;
  }

  .status-banner,
  .page-header-with-actions,
  .toolbar,
  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-grid-4,
  .stats-grid-3,
  .page-grid.two-columns,
  .form-grid,
  .governance-grid,
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .page-actions,
  .toolbar-actions,
  .stack-list,
  .feed-item-actions {
    width: 100%;
  }

  .page-actions .button,
  .toolbar-actions .button,
  .stack-list .button {
    width: 100%;
  }
}
