* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background-color: #f4f7fb;
  color: #222;
  font-size: 14px;
  line-height: 1.5;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.2s, transform 0.1s;
}
.btn:hover { background: #1d4ed8; }
.btn:active { transform: scale(0.97); }
.btn:disabled { background: #9ca3af; cursor: not-allowed; transform: none; }
.btn-secondary { background: #f3f4f6; color: #374151; border: 1px solid #e5e7eb; }
.btn-secondary:hover { background: #e5e7eb; }
.btn-danger { background: #ef4444; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: #059669; }
.btn-success:hover { background: #047857; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}
.form-group .hint { margin-top: 4px; font-size: 12px; color: #6b7280; }
.form-group .error { margin-top: 4px; font-size: 12px; color: #dc2626; }

.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  padding: 20px;
}

.container { max-width: 1200px; margin: 0 auto; padding: 20px 12px; }
.container-narrow { max-width: 420px; margin: 0 auto; padding: 20px 12px; }

.navbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar .brand {
  font-size: 16px;
  font-weight: 700;
  color: #1e40af;
  display: flex;
  align-items: center;
  gap: 8px;
}
.navbar .nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
.navbar .nav-links a {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13.5px;
  color: #4b5563;
  font-weight: 500;
}
.navbar .nav-links a:hover { background: #f3f4f6; text-decoration: none; }
.navbar .nav-links a.active { background: #eff6ff; color: #2563eb; }
.navbar .user-info {
  font-size: 13px;
  color: #4b5563;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-30px);
  background: #1f2937;
  color: #fff;
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: #059669; }
.toast.error { background: #dc2626; }
.toast.info { background: #2563eb; }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #6b7280;
  font-size: 14px;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
}
.empty .icon { font-size: 48px; margin-bottom: 12px; }
.empty .title { font-size: 15px; color: #6b7280; margin-bottom: 8px; }
.empty .desc { font-size: 13px; margin-bottom: 20px; }

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0;
  gap: 12px;
}
.page-title { font-size: 20px; color: #1f2937; font-weight: 700; }
.page-title .sub { font-size: 13px; color: #6b7280; font-weight: 400; margin-left: 8px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.class-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.class-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.12);
}
.class-card .name { font-size: 16px; font-weight: 700; color: #1e40af; margin-bottom: 6px; }
.class-card .meta { font-size: 12.5px; color: #6b7280; margin-bottom: 4px; }
.class-card .code {
  display: inline-block;
  background: #eff6ff;
  color: #2563eb;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
  margin-top: 8px;
}
.class-card .role-tag {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  margin-left: 6px;
  font-weight: 500;
}

@media (max-width: 600px) {
  .navbar { padding: 0 10px; height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .navbar .nav-links a { padding: 5px 10px; font-size: 12.5px; }
}