:root {
  --ink: #101828;
  --muted: #7a8699;
  --line: #e6eaf2;
  --bg: #f4f6fb;
  --brand: #4f46e5;
  --mint: #12b981;
  --danger: #e5484d;
  --amber: #f59e0b;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 30px 28px 60px;
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(140deg, #4f46e5, #8b5cf6);
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.3);
  position: relative;
}

.mark::after {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
}

.brand-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 1px;
}

.brand-sub {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
}

.head-actions {
  display: flex;
  gap: 10px;
}

.key-input {
  width: 200px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 14px;
  font-size: 13px;
  outline: none;
}

.key-input:focus {
  border-color: rgba(79, 70, 229, 0.6);
}

.btn {
  height: 40px;
  padding: 0 20px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}

.btn:hover {
  background: #f8f9fd;
}

.btn.primary {
  background: linear-gradient(135deg, #4f46e5, #7c6cff);
  border: none;
  color: #fff;
  font-weight: 600;
  width: 100%;
  margin-top: 10px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.card {
  background: #fff;
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.05);
}

.card-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 1px;
}

.card-num {
  margin-top: 10px;
  font-size: 36px;
  font-weight: 700;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  line-height: 1;
}

.card-num.warn {
  color: var(--danger);
}

.card-foot {
  margin-top: 8px;
  font-size: 11px;
  color: #9aa4b7;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr);
  gap: 18px;
}

.panel {
  background: #fff;
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.05);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-head h2 {
  font-size: 15px;
  font-weight: 700;
}

.hint {
  font-size: 11px;
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  max-height: 520px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

th {
  position: sticky;
  top: 0;
  background: #fff;
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 11px 8px;
  border-bottom: 1px solid #f3f5f9;
  white-space: nowrap;
}

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

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0 !important;
}

.pill {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
}

.pill.ok {
  background: rgba(18, 185, 129, 0.1);
  color: #0c8f63;
}

.pill.bad {
  background: rgba(229, 72, 77, 0.1);
  color: #c0373b;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tip {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 10px;
}

textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fafbfe;
  padding: 12px;
  font-size: 12px;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  line-height: 1.7;
  resize: vertical;
  outline: none;
}

textarea:focus {
  border-color: rgba(79, 70, 229, 0.5);
}

.import-result {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--mint);
  min-height: 16px;
}

.student-list {
  max-height: 300px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.student-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: 10px;
  background: #f8f9fd;
  font-size: 12px;
}

.student-row .who {
  font-weight: 600;
}

.student-row .meta {
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 2px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d0d5dd;
}

.dot.on {
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(18, 185, 129, 0.12);
}

.student-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mini-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #c0373b;
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.mini-btn:hover {
  background: #fff5f5;
  border-color: rgba(229, 72, 77, 0.3);
}

.mini-btn.edit-btn {
  color: #4f46e5;
}

.mini-btn.edit-btn:hover {
  background: #f5f3ff;
  border-color: rgba(79, 70, 229, 0.3);
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 24, 40, 0.45);
  z-index: 50;
}

/* hidden 必须真的隐藏，否则弹窗会一直挡住页面、点什么都没反应 */
.modal[hidden] {
  display: none !important;
}

.modal-card {
  width: min(420px, 90vw);
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 30px 80px rgba(16, 24, 40, 0.25);
}

.modal-card h2 {
  font-size: 17px;
  margin-bottom: 16px;
}

.modal-card label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

.modal-card input {
  display: block;
  width: 100%;
  height: 40px;
  margin-top: 6px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fafbfe;
  padding: 0 12px;
  font-size: 13px;
  color: var(--ink);
  outline: none;
}

.modal-card input:focus {
  border-color: rgba(79, 70, 229, 0.5);
}

.modal-card input:disabled,
.modal-card input[readonly] {
  background: #f2f4f7;
  color: #667085;
}

.modal-tip {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
  margin: 4px 0 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-actions .btn.danger {
  margin-right: auto;
  color: #c0373b;
  border-color: rgba(229, 72, 77, 0.35);
  background: #fff7f7;
}

.modal-actions .btn.danger:hover {
  background: #ffecec;
}

.modal-actions .btn.warn {
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.35);
  background: #fffbeb;
}

.modal-actions .btn.warn:hover {
  background: #fef3c7;
}

.modal-actions .btn.primary {
  width: auto;
  margin-top: 0;
  padding: 0 22px;
}

@media (max-width: 980px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid {
    grid-template-columns: 1fr;
  }
}
