:root {
  --bg: #ffffff;
  --fg: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --healthy: #16a34a;
  --stale: #d97706;
  --error: #dc2626;
  --paused: #6b7280;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.5;
}

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  max-width: 960px;
  margin: 0 auto;
}

.site-nav .brand {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--fg);
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover { color: var(--fg); }

.site-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1rem;
  text-align: center;
}

h1 { margin-top: 0; }

.hero { padding: 2rem 0; }
.lede { color: var(--muted); max-width: 40rem; }

.button, button {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}

.link-button {
  background: none;
  color: var(--muted);
  padding: 0;
  text-decoration: underline;
}

.quickstart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.card {
  min-width: 0; /* otherwise a long unbreakable <pre> line forces the grid
                   track wider than its column, blowing out the whole grid
                   instead of scrolling within pre's own overflow-x */
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

pre {
  background: #0b1021;
  color: #e5e7eb;
  padding: 0.75rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.85rem;
  max-width: 100%;
}

pre code {
  white-space: pre;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.filters input, .filters select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.feed-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  text-decoration: none;
  color: var(--fg);
}

.feed-card:hover { border-color: var(--accent); }
.feed-card-title { font-weight: 600; margin-bottom: 0.35rem; }
.feed-card-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); }

.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
}

.status-healthy { background: var(--healthy); }
.status-stale { background: var(--stale); }
.status-error { background: var(--error); }
.status-paused { background: var(--paused); }

.feed-meta { display: flex; gap: 0.75rem; align-items: center; color: var(--muted); margin-top: -0.5rem; }

.endpoint-box { margin: 1rem 0; }
.copy-row { display: flex; gap: 0.5rem; }
.copy-row input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: monospace;
}

.schema-table, .health-table, .admin-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.schema-table th, .schema-table td,
.health-table th, .health-table td,
.admin-table th, .admin-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.5rem;
  text-align: left;
}

.muted { color: var(--muted); }
.error { color: var(--error); }
.empty { color: var(--muted); padding: 2rem 0; }

.health-summary { display: flex; gap: 0.5rem; margin-bottom: 1rem; }

.admin-login {
  max-width: 320px;
  margin: 4rem auto;
}

.admin-login form, .admin-feed-detail form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-login label, .admin-feed-detail label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.admin-login input {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.toggle-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}

.stat-value { font-size: 1.1rem; font-weight: 600; }
.stat-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

@media (max-width: 480px) {
  .site-nav { flex-wrap: wrap; }
  .copy-row { flex-direction: column; }
}
