/* Same as contribute.css: map app sets html,body { overflow:hidden }; allow scroll here */
html:has(body.page-body) {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body.page-body {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
}

/* ─── Login ──────────────────────────────────────────────────── */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.login-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.login-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: #ef4444;
}

/* ─── Admin layout ───────────────────────────────────────────── */
.admin-app { display: flex; flex-direction: column; height: 100vh; }

.admin-main {
  display: grid;
  grid-template-columns: 220px 1fr;
  flex: 1;
  overflow: hidden;
  margin-top: var(--header-h);
  height: calc(100vh - var(--header-h));
}

.admin-nav {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.admin-nav-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.admin-nav-btn:hover { background: var(--surface-2); color: var(--text); }
.admin-nav-btn.active { background: var(--accent-dim); color: var(--accent); }

.nav-badge {
  background: var(--accent);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

.admin-name {
  font-size: 13px;
  color: var(--text-dim);
}

.admin-content {
  overflow-y: auto;
  padding: 28px 32px;
}

/* ─── Stats dashboard ────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card-num {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Contribution review cards ──────────────────────────────── */
.review-list { display: flex; flex-direction: column; gap: 16px; }

.review-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.review-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.review-card-person {
  display: flex;
  align-items: center;
  gap: 12px;
}

.review-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--teal);
  background: var(--teal-dim);
  flex-shrink: 0;
}

.review-name {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}

.review-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.status-badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 600;
}

.status-pending  { background: rgba(245,158,11,0.15); color: #f59e0b; }
.status-approved { background: rgba(200,240,96,0.12); color: var(--accent); }
.status-rejected { background: rgba(239,68,68,0.12);  color: #ef4444; }
.status-revision_requested { background: rgba(45,212,191,0.12); color: var(--teal); }

.review-card-body {
  padding: 16px 20px;
}

.review-statement {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.review-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }

.review-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.action-btn {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.action-approve {
  background: var(--accent-dim);
  border-color: rgba(200,240,96,0.3);
  color: var(--accent);
}
.action-approve:hover { background: rgba(200,240,96,0.2); }

.action-reject {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.3);
  color: #ef4444;
}
.action-reject:hover { background: rgba(239,68,68,0.15); }

.action-revision {
  background: var(--teal-dim);
  border-color: rgba(45,212,191,0.3);
  color: var(--teal);
}
.action-revision:hover { background: rgba(45,212,191,0.15); }

.notes-input {
  flex: 1;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12px;
  outline: none;
}

.notes-input:focus { border-color: var(--accent); }

/* ─── Admin management table ──────────────────────────────────── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.admin-table th {
  background: var(--surface-2);
  padding: 10px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.admin-table tr:last-child td { border-bottom: none; }

.role-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
}

.role-superadmin { background: rgba(200,240,96,0.1); color: var(--accent); }
.role-admin { background: var(--surface-2); color: var(--text-muted); }

/* ─── Sync log ────────────────────────────────────────────────── */
.sync-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.sync-btn {
  padding: 9px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.sync-btn:hover { border-color: var(--accent); color: var(--accent); }

.sync-log-list { display: flex; flex-direction: column; gap: 8px; }

.sync-log-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.sync-source {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  width: 80px;
}

.sync-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sync-status-dot.success { background: var(--accent); }
.sync-status-dot.error   { background: #ef4444; }
.sync-status-dot.running { background: var(--teal); }

.section-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.add-admin-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto auto;
  gap: 10px;
  align-items: end;
}

@media (max-width: 900px) {
  .admin-main { grid-template-columns: 1fr; }
  .admin-nav { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 8px; flex-wrap: wrap; }
  .add-admin-form { grid-template-columns: 1fr 1fr; }
}

/* ─── BibTeX import ─────────────────────────────────────────── */
.bibtex-import-wrap { max-width: 900px; }
.bibtex-file-input {
  font-size: 13px;
  color: var(--text-dim);
}
.bibtex-textarea {
  width: 100%;
  min-height: 220px;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
}
.bibtex-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
}
.bibtex-checkbox-row input { margin-top: 3px; }
.bibtex-import-result {
  margin-top: 18px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}
.bibtex-summary { margin-bottom: 12px; }
.bibtex-import-details {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: rgba(0,0,0,0.2);
}
.bibtex-import-line {
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}
.bibtex-import-line:last-child { border-bottom: none; }
