* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #222; background: #f5f7fa;
}
.hide { display: none !important; }

/* ---------------- 登录 ---------------- */
.login {
  height: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1f2937, #2e7d32);
}
.login-box {
  width: 340px; background: #fff; border-radius: 12px; padding: 30px 28px;
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
}
.brand { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.brand span { font-size: 13px; font-weight: 400; color: #8b9099; margin-left: 4px; }
.login-box .brand { margin-bottom: 22px; text-align: center; }
.login-box label { display: block; font-size: 12px; color: #6b7078; margin: 12px 0 5px; }
.login-box input {
  width: 100%; height: 38px; padding: 0 10px; border: 1px solid #d7dde6;
  border-radius: 7px; font-size: 14px; font-family: inherit;
}
.login-box input:focus {
  outline: none; border-color: #2e7d32; box-shadow: 0 0 0 3px rgba(46,125,50,.12);
}
.login-box button { width: 100%; margin-top: 20px; }
.msg { margin-top: 12px; font-size: 13px; color: #c62828; text-align: center; min-height: 18px; }

button { font-family: inherit; cursor: pointer; }
button.primary {
  height: 38px; padding: 0 18px; border: none; border-radius: 7px;
  background: #2e7d32; color: #fff; font-size: 14px; font-weight: 600;
}
button.primary:active { transform: scale(.98); }
button.ghost {
  height: 38px; padding: 0 16px; border: 1px solid #d7dde6; border-radius: 7px;
  background: #fff; color: #444; font-size: 14px;
}
button.mini {
  height: 28px; padding: 0 10px; border: 1px solid #d7dde6; border-radius: 6px;
  background: #fff; color: #2e7d32; font-size: 12px;
}
button.mini.danger { color: #c62828; }
button.mini:hover { background: #f1f8e9; }

/* ---------------- 主体 ---------------- */
.app { height: 100%; display: flex; flex-direction: column; }
header {
  height: 52px; flex: none; display: flex; align-items: center; gap: 26px;
  padding: 0 20px; background: #1f2937; color: #fff;
}
header .brand { color: #fff; }
header .brand span { color: #9aa6b8; }
header nav { display: flex; gap: 4px; flex: 1; }
header nav a {
  padding: 6px 14px; border-radius: 7px; color: #b9c3d3; font-size: 14px;
  cursor: pointer; text-decoration: none;
}
header nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
header nav a.on { background: #2e7d32; color: #fff; font-weight: 600; }
header .right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: #b9c3d3; }
header .link { color: #b9c3d3; cursor: pointer; text-decoration: underline; }

main { flex: 1; overflow: auto; padding: 20px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.stat { background: #fff; border: 1px solid #e3e8ef; border-radius: 10px; padding: 16px 18px; }
.stat .k { font-size: 12px; color: #8b9099; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 4px; color: #1f2937; }

.panel {
  background: #fff; border: 1px solid #e3e8ef; border-radius: 10px;
  overflow: hidden; margin-bottom: 16px;
}
.panel-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid #eef2f7;
}
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-head .sp { flex: 1; }
.panel-body { padding: 14px 16px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid #eef2f7; }
th { background: #f8fafc; color: #6b7078; font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: none; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px;
  background: #eef2ff; color: #2f6fed; margin: 1px 3px 1px 0; }
.tag.gray { background: #f1f3f6; color: #6b7078; }
.tag.green { background: #e8f5e9; color: #2e7d32; }
.tag.red { background: #fdecea; color: #c62828; }
.tag.amber { background: #fff8e1; color: #b26a00; }

.empty { padding: 40px; text-align: center; color: #9aa0a6; font-size: 13px; }

/* 上传区 */
.upload {
  border: 2px dashed #cbd5e1; border-radius: 10px; padding: 26px;
  text-align: center; color: #6b7078; background: #fbfcfe; cursor: pointer;
  transition: .15s;
}
.upload:hover, .upload.drag { border-color: #2e7d32; background: #f4faf5; color: #2e7d32; }
.upload b { color: #2e7d32; }
.upload .hint { font-size: 12px; color: #9aa0a6; margin-top: 6px; }

/* 课件网格 */
.decks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.deck {
  background: #fff; border: 1px solid #e3e8ef; border-radius: 10px; overflow: hidden;
  cursor: pointer; transition: .15s;
}
.deck:hover { border-color: #2e7d32; box-shadow: 0 4px 14px rgba(0,0,0,.07); }
.deck .cover {
  height: 108px; background: #eef2f7; display: flex; align-items: center;
  justify-content: center; color: #9aa0a6; font-size: 13px; overflow: hidden;
}
.deck .cover img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  background: #fff;
}
.deck .meta { padding: 9px 11px; }
.deck .meta b { display: block; font-size: 13px; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck .meta span { font-size: 12px; color: #8b9099; }

/* 课表 */
.week-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.week-bar .range { font-size: 14px; color: #2b3440; font-weight: 600; }
.week-bar .sp { flex: 1; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
@media (max-width: 1100px) { .week { grid-template-columns: repeat(2, 1fr); } }

.day {
  background: #fff; border: 1px solid #e3e8ef; border-radius: 10px;
  min-height: 150px; display: flex; flex-direction: column; overflow: hidden;
}
.day.today { border-color: #2e7d32; box-shadow: 0 0 0 2px rgba(46,125,50,.12); }
.day .dh {
  padding: 8px 10px; background: #f8fafc; border-bottom: 1px solid #eef2f7;
  font-size: 12px; color: #6b7078; display: flex; align-items: baseline; gap: 6px;
}
.day .dh b { font-size: 13px; color: #26313d; }
.day .db { padding: 8px; display: flex; flex-direction: column; gap: 6px; flex: 1; }

.slot {
  border-radius: 7px; padding: 6px 8px; font-size: 12px; line-height: 1.5;
  background: #eef7ee; border: 1px solid #cfe6d1; color: #1f4d24; cursor: pointer;
}
.slot:hover { background: #e2f1e3; }
.slot .t { font-weight: 600; }
.slot .sub { color: #4b7a4f; }
.slot.off { background: #f4f5f7; border-color: #e0e3e8; color: #8b9099; text-decoration: line-through; }
.slot .badge {
  float: right; font-size: 11px; background: #2e7d32; color: #fff;
  padding: 0 6px; border-radius: 8px;
}

.lesson {
  border-radius: 7px; padding: 6px 8px; font-size: 12px; line-height: 1.5;
  background: #fdecea; border: 1px solid #f6cfcb; color: #a3251c;
}
.lesson .t { font-weight: 600; }

.offbar {
  font-size: 11px; color: #8b9099; background: #f4f5f7;
  border-radius: 6px; padding: 4px 7px;
}

/* 弹窗 */
.modal {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center; z-index: 350;
}
.modal-box {
  width: 460px; max-width: 92vw; max-height: 86vh; background: #fff;
  border-radius: 12px; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-head {
  display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid #eef2f7;
}
.modal-head b { flex: 1; font-size: 15px; }
.modal-head .x { cursor: pointer; font-size: 20px; color: #9aa0a6; line-height: 1; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 18px; border-top: 1px solid #eef2f7;
}
.form label { display: block; font-size: 12px; color: #6b7078; margin: 12px 0 5px; }
.form label:first-child { margin-top: 0; }
.form input, .form select {
  width: 100%; height: 38px; padding: 0 10px; border: 1px solid #d7dde6;
  border-radius: 7px; font-size: 14px; font-family: inherit; background: #fff;
}
.form .row { display: flex; gap: 10px; }
.form .row > * { flex: 1; }
.form .hint { font-size: 12px; color: #9aa0a6; margin-top: 6px; }

/* 页图查看器 */
.viewer {
  position: fixed; inset: 0; background: rgba(10,12,16,.94); z-index: 300;
  display: flex; flex-direction: column;
}
.viewer-bar {
  height: 46px; flex: none; display: flex; align-items: center; gap: 14px;
  padding: 0 16px; color: #cfd3d9; font-size: 13px;
}
.viewer-bar .sp { flex: 1; }
.viewer-bar .x { font-size: 24px; cursor: pointer; color: #cfd3d9; }
.viewer-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 0 10px 14px; min-height: 0;
}
.viewer-body img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  background: #fff; border-radius: 4px;
}
.navbtn {
  width: 46px; height: 70px; border: none; border-radius: 8px;
  background: rgba(255,255,255,.12); color: #fff; font-size: 26px; flex: none;
}
.navbtn:disabled { opacity: .25; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: rgba(20,22,26,.9); color: #fff; padding: 9px 18px; border-radius: 8px;
  font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 400;
}
.toast.show { opacity: 1; }
