/* ===== 交作业 · 教学氛围 UI ===== */
:root {
  --bg: #f5efe1;
  --bg-soft: #ede4cf;
  --paper: #fffaf0;
  --ink: #2d3a2e;
  --ink-soft: #5b6b5c;
  --primary: #2f6b3e;
  --primary-soft: #5fa86d;
  --gold: #b8902a;
  --gold-soft: #e7c97a;
  --line: #c8bfa3;
  --danger: #b03a2e;
  --shadow: 0 4px 16px rgba(60,50,30,.08);
  --radius: 14px;
  --serif: "Noto Serif SC", "Songti SC", "SimSun", "FangSong", serif;
  --sans: "Noto Sans SC", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(183,144,42,.08) 0, transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(47,107,62,.07) 0, transparent 40%);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: .02em; color: var(--ink); }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--gold); }

.topbar {
  background: linear-gradient(135deg, #2f6b3e 0%, #5fa86d 100%);
  color: #fff;
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 50;
}
.topbar .brand {
  font-family: var(--serif); font-size: 22px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.topbar .brand .seal {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gold); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; box-shadow: 0 2px 8px rgba(0,0,0,.2);
  border: 2px solid rgba(255,255,255,.4);
}
.topbar .nav { display: flex; gap: 6px; flex-wrap: wrap; }
.topbar .nav a {
  color: #fff; padding: 8px 14px; border-radius: 999px;
  background: rgba(255,255,255,.12); font-size: 14px;
}
.topbar .nav a:hover { background: rgba(255,255,255,.25); color: #fff; }
.topbar .nav a.active { background: var(--gold); }
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 14px; }

.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px 80px; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  position: relative;
}
.card-title {
  font-family: var(--serif); font-size: 20px; margin: 0 0 14px;
  display: flex; align-items: center; gap: 10px;
}
.card-title::before {
  content: ''; width: 4px; height: 22px; background: var(--gold); border-radius: 2px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 18px; border-radius: 10px;
  border: none; cursor: pointer; font-size: 14px; font-weight: 500;
  background: var(--primary); color: #fff;
  transition: all .15s; font-family: var(--sans);
}
.btn:hover { background: #245b32; transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.gold { background: var(--gold); }
.btn.gold:hover { background: #957020; }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn.ghost:hover { background: var(--primary); color: #fff; }
.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.full { width: 100%; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff;
  font-family: var(--sans); font-size: 14px; color: var(--ink);
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,107,62,.15);
}

.list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.list-item {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  transition: all .15s;
}
.list-item:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--gold-soft); }
.list-item .title { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--ink); }
.list-item .meta { font-size: 13px; color: var(--ink-soft); }
.list-item .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 640px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
.assignment-cell {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; text-align: center; cursor: pointer;
  transition: all .15s;
}
.assignment-cell:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow); }
.assignment-cell .pic {
  width: 100%; aspect-ratio: 1/1; border-radius: 8px;
  background: var(--bg-soft) center/cover no-repeat;
  margin-bottom: 6px; position: relative; overflow: hidden;
}
.assignment-cell .pic.empty::after {
  content: '📝'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; font-size: 36px; opacity: .35;
}
.assignment-cell .label { font-family: var(--serif); font-size: 14px; font-weight: 600; }
.assignment-cell .date { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge.优秀 { background: #e7c97a; color: #6e5410; }
.badge.良好 { background: #b8d8be; color: #2f6b3e; }
.badge.合格 { background: #f5e1c0; color: #8a6a1f; }
.badge.不及格 { background: #f4c6c0; color: #8a2e25; }
.badge.未批 { background: #d8d4c7; color: #5b5b5b; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat-box {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; text-align: center;
}
.stat-box .num { font-family: var(--serif); font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-box .label { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); }
table.tbl { width: 100%; border-collapse: collapse; background: var(--paper); min-width: 600px; }
table.tbl th, table.tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
table.tbl th { background: var(--bg-soft); font-family: var(--serif); font-weight: 600; }
table.tbl tr:hover { background: rgba(184,144,42,.06); }
table.tbl td.rank { font-weight: 700; color: var(--gold); }
table.tbl td.rank-1 { background: linear-gradient(90deg, rgba(231,201,122,.25), transparent); }
table.tbl td.total { font-weight: 700; color: var(--primary); font-size: 16px; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 22px;
  border-radius: 999px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
  z-index: 9999; font-size: 14px; opacity: 0; transition: opacity .25s;
  pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--primary); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(45,58,46,.5);
  display: none; align-items: center; justify-content: center; z-index: 100;
  padding: 16px;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--paper); border-radius: var(--radius);
  width: 100%; max-width: 520px; padding: 22px;
  box-shadow: 0 16px 48px rgba(0,0,0,.25);
  max-height: 90vh; overflow-y: auto;
}
.modal h3 { margin: 0 0 16px; font-family: var(--serif); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.login-bg {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(47,107,62,.18), transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(184,144,42,.18), transparent 50%),
    var(--bg);
  padding: 20px;
}
.login-card {
  background: var(--paper); border-radius: var(--radius);
  padding: 36px 32px; width: 100%; max-width: 380px;
  box-shadow: 0 12px 40px rgba(60,50,30,.15);
  border: 1px solid var(--line);
}
.login-card .logo {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--gold); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 36px; font-weight: 700;
  margin: 0 auto 16px; box-shadow: 0 6px 20px rgba(184,144,42,.3);
  border: 3px solid rgba(255,255,255,.5);
}
.login-card h1 { text-align: center; margin: 0 0 6px; font-size: 24px; }
.login-card .sub { text-align: center; color: var(--ink-soft); font-size: 13px; margin-bottom: 22px; }

.search-input {
  width: 100%; padding: 10px 14px 10px 36px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--paper) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6b5c' stroke-width='2'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 12px center / 16px;
  font-size: 14px;
}
.search-input:focus { outline: none; border-color: var(--primary); }

.student-pick {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px;
  max-height: 50vh; overflow-y: auto; padding: 4px;
}
.student-pick button {
  padding: 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--paper); font-family: var(--serif); font-size: 14px;
  cursor: pointer;
}
.student-pick button:hover { border-color: var(--gold); background: rgba(231,201,122,.15); }
.student-pick button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.upload-zone {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 28px; text-align: center; cursor: pointer; background: var(--paper);
  transition: all .15s;
}
.upload-zone:hover { border-color: var(--gold); background: rgba(231,201,122,.05); }
.upload-zone.has-image { padding: 0; border: none; }
.upload-zone.has-image img { width: 100%; border-radius: var(--radius); display: block; }
.upload-zone .hint { color: var(--ink-soft); font-size: 13px; margin-top: 6px; }
.upload-zone .ico { font-size: 42px; }

.score-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.score-pick button {
  padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--paper); font-family: var(--serif); font-size: 14px;
  cursor: pointer; font-weight: 600;
}
.score-pick button .num { display: block; font-size: 18px; color: var(--gold); }
.score-pick button.active.优秀 { background: #e7c97a; border-color: #e7c97a; }
.score-pick button.active.良好 { background: #b8d8be; border-color: #b8d8be; }
.score-pick button.active.合格 { background: #f5e1c0; border-color: #f5e1c0; }
.score-pick button.active.不及格 { background: #f4c6c0; border-color: #f4c6c0; }

.empty-state {
  text-align: center; padding: 40px 20px; color: var(--ink-soft);
}
.empty-state .ico { font-size: 48px; opacity: .4; margin-bottom: 12px; }

.seal-badge {
  position: absolute; top: -8px; right: -8px;
  background: var(--danger); color: #fff;
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 13px; font-weight: 700;
  transform: rotate(-12deg); box-shadow: 0 4px 12px rgba(176,58,46,.4);
  border: 2px solid rgba(255,255,255,.5);
  line-height: 1.1; text-align: center;
}

@media (max-width: 640px) {
  .container { padding: 14px 12px 60px; }
  .topbar { padding: 10px 14px; }
  .topbar .brand { font-size: 18px; }
  .topbar .brand .seal { width: 30px; height: 30px; font-size: 15px; }
  .topbar .nav a { padding: 6px 10px; font-size: 13px; }
  .card { padding: 14px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
