*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; font-family: "Noto Sans KR", sans-serif;
  background: #f8fafc; color: #0f172a; min-height: 100vh;
}

.admin-header {
  background: #fff; border-bottom: 1px solid #e2e8f0;
  padding: 16px 24px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.admin-brand { display: flex; align-items: center; gap: 12px; }
.admin-brand-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1rem; color: #fff;
}
.admin-brand strong { font-size: 0.95rem; color: #1e293b; }
.admin-brand small { font-size: 0.75rem; color: #94a3b8; margin-left: 8px; }
.admin-nav { display: flex; gap: 8px; }
.admin-nav a {
  padding: 8px 16px; border-radius: 8px; font-size: 0.82rem;
  font-weight: 600; color: #64748b; text-decoration: none;
  transition: all 150ms;
}
.admin-nav a:hover { background: #f1f5f9; color: #2563eb; }

.admin-body { max-width: 1200px; margin: 0 auto; padding: 24px; }

.stats-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.stat-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
  padding: 16px 20px;
}
.stat-card .label { font-size: 0.76rem; color: #94a3b8; font-weight: 600; }
.stat-card .value { font-size: 1.5rem; font-weight: 800; color: #1e293b; margin-top: 4px; }

.section-title {
  font-size: 1.1rem; font-weight: 800; color: #1e293b;
  margin: 0 0 16px; display: flex; align-items: center; gap: 8px;
}

.member-table-wrap {
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 16px; overflow: hidden;
}
.member-table {
  width: 100%; border-collapse: collapse; font-size: 0.84rem;
}
.member-table th {
  background: #f8fafc; padding: 12px 16px; text-align: left;
  font-weight: 700; color: #64748b; border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.member-table td {
  padding: 12px 16px; border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.member-table tr:last-child td { border-bottom: none; }
.member-table tr:hover td { background: #f8fafc; }

.grade-badge {
  display: inline-block; padding: 3px 10px; border-radius: 6px;
  font-size: 0.72rem; font-weight: 700;
}
.grade-badge.associate { background: #e0f2fe; color: #0284c7; }
.grade-badge.regular { background: #f0fdf4; color: #16a34a; }
.grade-badge.instructor { background: #fef3c7; color: #d97706; }
.grade-badge.admin { background: #ede9fe; color: #7c3aed; }

.grade-select {
  padding: 4px 8px; border-radius: 6px; border: 1px solid #e2e8f0;
  font-size: 0.78rem; font-family: inherit; cursor: pointer;
}

.perm-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.perm-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 6px; font-size: 0.72rem;
  font-weight: 600; background: #dbeafe; color: #1d4ed8;
}
.perm-tag .remove-perm {
  cursor: pointer; font-weight: 900; color: #93c5fd;
  font-size: 0.8rem; line-height: 1;
}
.perm-tag .remove-perm:hover { color: #dc2626; }

.add-perm-btn {
  padding: 3px 8px; border-radius: 6px; border: 1px dashed #cbd5e1;
  background: none; font-size: 0.72rem; font-weight: 600;
  color: #94a3b8; cursor: pointer; font-family: inherit;
}
.add-perm-btn:hover { border-color: #2563eb; color: #2563eb; }

/* 모달 */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(15,23,42,0.6); align-items: center; justify-content: center;
}
.modal-overlay.visible { display: flex; }
.modal {
  background: #fff; border-radius: 20px; padding: 28px;
  max-width: 420px; width: calc(100% - 40px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal h3 { margin: 0 0 16px; font-size: 1.1rem; font-weight: 800; color: #1e293b; }
.modal-content-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.modal-content-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 10px;
  cursor: pointer; transition: all 150ms;
}
.modal-content-item:hover { border-color: #2563eb; background: #eff6ff; }
.modal-content-item.granted { border-color: #86efac; background: #f0fdf4; }
.modal-content-item .check {
  width: 20px; height: 20px; border-radius: 6px; border: 2px solid #cbd5e1;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; color: #fff; flex-shrink: 0;
}
.modal-content-item.granted .check {
  background: #16a34a; border-color: #16a34a;
}
.modal-content-item .info strong { display: block; font-size: 0.84rem; color: #1e293b; }
.modal-content-item .info small { font-size: 0.72rem; color: #94a3b8; }
.modal-close {
  width: 100%; padding: 10px; border: none; border-radius: 10px;
  background: #f1f5f9; color: #475569; font-weight: 700;
  font-family: inherit; cursor: pointer; font-size: 0.88rem;
}
.modal-close:hover { background: #e2e8f0; }

.status-active { color: #16a34a; font-weight: 700; }
.status-suspended { color: #dc2626; font-weight: 700; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px; border-radius: 12px; background: #1e293b; color: #fff;
  font-size: 0.84rem; font-weight: 600; z-index: 10000;
  opacity: 0; transition: opacity 300ms;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.toast.show { opacity: 1; }

.empty-msg { text-align: center; padding: 40px; color: #94a3b8; font-size: 0.9rem; }

@media (max-width: 768px) {
  .member-table-wrap { overflow-x: auto; }
  .admin-body { padding: 16px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
