@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --bg: #15171c;
  --surface: #1d2027;
  --surface-raised: #23262e;
  --border: #2a2e37;
  --border-strong: #383d49;
  --text: #eae7e0;
  --text-dim: #8c8f94;
  --text-faint: #5c5f66;
  --accent-resource: #4fa89c;
  --accent-resource-bg: #1a2a28;
  --accent-knowledge: #cc9a52;
  --accent-knowledge-bg: #2a2418;
  --accent-dead: #b4615b;
  --accent-dead-bg: #2a1c1b;
  --radius: 3px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

h1, h2, h3, .serif {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

a { color: inherit; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px 80px;
}

/* ---- Masthead ---- */
.masthead {
  border-bottom: 1px solid var(--border);
  padding: 36px 0 22px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

.masthead h1 { font-size: 26px; }

.masthead .sub {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 6px;
}

.ledger-stats {
  display: flex;
  gap: 28px;
}

.ledger-stats .stat { text-align: right; }
.ledger-stats .stat .num {
  font-family: 'Source Serif 4', serif;
  font-size: 20px;
  font-weight: 600;
}
.ledger-stats .stat .label {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}

/* ---- Controls ---- */
.controls {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tabs {
  display: flex;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  border-right: 1px solid var(--border);
}
.tab:last-child { border-right: none; }
.tab:hover { color: var(--text); background: var(--surface-raised); }
.tab.active { background: var(--surface-raised); color: var(--text); }

input[type="text"], select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
}
input[type="text"] { min-width: 200px; }
input[type="text"]::placeholder { color: var(--text-faint); }

.spacer { flex: 1; }

button.btn {
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 7px 14px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
button.btn:hover { border-color: var(--text-dim); }
button.btn.primary { background: var(--accent-knowledge); color: #1a1509; border-color: var(--accent-knowledge); font-weight: 500; }
button.btn.danger { color: var(--accent-dead); }

/* ---- Grid ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color .15s;
}
.card:hover { border-color: var(--border-strong); }

.card .top { display: flex; gap: 10px; align-items: center; }
.card img.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; background: var(--surface-raised);
  flex-shrink: 0;
}
.card .name { font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 4px; }
.card .handle { font-size: 12px; color: var(--text-dim); }
.card .bio {
  font-size: 12.5px; color: var(--text-dim); margin-top: 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 32px;
}
.card .meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; font-size: 11px;
}
.tag-pill {
  padding: 2px 8px; border-radius: 10px; font-size: 10.5px;
}
.tag-pill.resource { background: var(--accent-resource-bg); color: var(--accent-resource); }
.tag-pill.knowledge { background: var(--accent-knowledge-bg); color: var(--accent-knowledge); }
.tag-pill.other { background: var(--surface-raised); color: var(--text-dim); }
.followers { color: var(--text-faint); }

.badge-verified {
  color: var(--accent-resource);
  font-size: 12px;
}

.empty-state {
  text-align: center; padding: 80px 20px; color: var(--text-dim);
}
.empty-state a.btn { display: inline-block; margin-top: 14px; text-decoration: none; }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,11,13,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 20px;
}
.modal {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 6px; max-width: 420px; width: 100%; padding: 28px;
}
.modal .avatar-lg { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.modal .name-lg { font-size: 19px; margin-top: 14px; }
.modal .bio-full { font-size: 13.5px; color: var(--text-dim); margin: 12px 0 20px; line-height: 1.7; }
.modal .actions { display: flex; gap: 10px; }
.modal .actions a { text-decoration: none; flex: 1; text-align: center; }

/* ---- Admin ---- */
.login-box {
  max-width: 340px; margin: 120px auto; text-align: center;
}
.login-box input { width: 100%; margin: 16px 0; }
.login-box button { width: 100%; }

table.admin-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
table.admin-table th, table.admin-table td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border);
}
table.admin-table th { color: var(--text-faint); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
table.admin-table tr:hover { background: var(--surface-raised); }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.status-active { background: var(--accent-resource); }
.status-pending { background: var(--accent-knowledge); }
.status-needs_review { background: var(--accent-dead); }
.status-suspended { background: var(--text-faint); }

.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--surface-raised);
  border: 1px solid var(--border-strong); padding: 12px 18px; border-radius: var(--radius);
  font-size: 13px; z-index: 100;
}

.add-row { display: flex; gap: 10px; margin-bottom: 20px; }
.add-row input { flex: 1; }

@media (max-width: 640px) {
  .wrap { padding: 0 16px 60px; }
  .masthead { flex-direction: column; align-items: flex-start; }
}
