/* ===== 基础 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #f6f6f6;
  color: #202122;
  line-height: 1.6;
}
a { color: #3366cc; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 登录页 ===== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3366cc 0%, #88aacc 100%);
}
.login-box {
  background: #fff;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  width: 360px;
}
.login-box h1 {
  font-size: 24px;
  text-align: center;
  margin-bottom: 8px;
  color: #202122;
}
.login-sub {
  text-align: center;
  color: #54595d;
  margin-bottom: 24px;
  font-size: 14px;
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  color: #54595d;
  margin-bottom: 4px;
  font-weight: 600;
}
.form-group input, .form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #a2a9b1;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
}
.form-group input:focus, .form-group textarea:focus {
  border-color: #3366cc;
  box-shadow: 0 0 0 2px rgba(51,102,204,0.2);
}
.form-group textarea {
  min-height: 200px;
  font-family: monospace;
  resize: vertical;
}
.login-error {
  color: #d33;
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 18px;
}
.btn-primary {
  width: 100%;
  padding: 10px;
  background: #3366cc;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
}
.btn-primary:hover { background: #2a55a8; }
.btn-small {
  padding: 4px 12px;
  background: #f8f9fa;
  border: 1px solid #a2a9b1;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.btn-small:hover { background: #eaecf0; }
.btn-edit {
  padding: 6px 16px;
  background: #3366cc;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}
.btn-edit:hover { background: #2a55a8; }
.btn-cancel {
  padding: 6px 16px;
  background: #f8f9fa;
  border: 1px solid #a2a9b1;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  margin-right: 8px;
}

/* ===== 顶栏 ===== */
.topbar {
  background: #fff;
  border-bottom: 1px solid #a2a9b1;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.site-title {
  font-size: 18px;
  font-weight: 700;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-label { font-size: 14px; color: #54595d; }

/* ===== 布局 ===== */
.wiki-layout {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 20px;
  padding: 20px;
}
.sidebar {
  width: 220px;
  flex-shrink: 0;
}
.sidebar-section {
  background: #fff;
  border: 1px solid #a2a9b1;
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 16px;
}
.sidebar-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  color: #54595d;
  margin-bottom: 8px;
  border-bottom: 1px solid #eaecf0;
  padding-bottom: 4px;
}
.sidebar-section ul { list-style: none; }
.sidebar-section ul li { margin: 4px 0; }
.sidebar-section ul li a { font-size: 14px; }
.sidebar-section input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #a2a9b1;
  border-radius: 4px;
  font-size: 13px;
}

.content {
  flex: 1;
  background: #fff;
  border: 1px solid #a2a9b1;
  border-radius: 4px;
  padding: 24px 32px;
  min-height: 500px;
}

/* ===== Wiki 内容 ===== */
.wiki-title {
  font-size: 28px;
  font-weight: 400;
  border-bottom: 1px solid #a2a9b1;
  padding-bottom: 8px;
  margin-bottom: 16px;
}
.wiki-tagline {
  color: #54595d;
  font-size: 14px;
  margin-bottom: 20px;
}

/* 信息框 */
.infobox {
  float: right;
  width: 280px;
  border: 1px solid #a2a9b1;
  background: #f8f9fa;
  border-radius: 4px;
  margin: 0 0 16px 20px;
  padding: 12px;
  font-size: 13px;
}
.infobox-title {
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  background: #eaecf0;
  margin: -12px -12px 10px -12px;
  padding: 8px;
  border-radius: 4px 4px 0 0;
}
.infobox-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dotted #c8ccd1;
}
.infobox-row:last-child { border-bottom: none; }
.infobox-label { color: #54595d; font-weight: 600; }
.infobox-value { text-align: right; }

/* 同学表格 */
.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.student-card {
  border: 1px solid #a2a9b1;
  border-radius: 4px;
  padding: 12px;
  background: #f8f9fa;
  cursor: pointer;
  transition: background 0.15s;
}
.student-card:hover { background: #eaecf0; text-decoration: none; }
.student-card .card-id { font-size: 12px; color: #54595d; }
.student-card .card-name { font-size: 15px; font-weight: 600; color: #202122; margin-top: 4px; }

/* Markdown 内容 */
.md-content h1, .md-content h2, .md-content h3 {
  border-bottom: 1px solid #eaecf0;
  padding-bottom: 4px;
  margin: 16px 0 8px;
}
.md-content p { margin: 8px 0; }
.md-content code {
  background: #eaecf0;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
}
.md-content pre {
  background: #f8f9fa;
  padding: 12px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 8px 0;
}

/* 编辑表单 */
.edit-form .form-group { margin-bottom: 16px; }
.edit-actions { margin-top: 20px; }

.save-status {
  margin-top: 12px;
  font-size: 14px;
  min-height: 20px;
}
.save-status.ok { color: #14863d; }
.save-status.err { color: #d33; }

/* 响应式 */
@media (max-width: 768px) {
  .wiki-layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .infobox { float: none; width: 100%; margin: 0 0 16px 0; }
}
