* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; background: #f5f7fa; color: #222; font-size: 14px; line-height: 1.5; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; border: 1px solid #d5dbe2; border-radius: 6px; padding: 8px 10px; outline: none; background: #fff; color: #222; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: #2b7cdd; box-shadow: 0 0 0 2px rgba(43,124,221,.15); }

/* ---- 老师端 ---- */
.page { max-width: 760px; margin: 0 auto; padding-bottom: 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: #fff; border-bottom: 1px solid #e6e9ee; position: sticky; top: 0; z-index: 10; }
.brand { font-size: 18px; font-weight: 700; }
.tabs { display: flex; gap: 6px; }
.tab { border: 0; background: #eef2f7; padding: 7px 14px; border-radius: 16px; font-size: 13px; color: #555; }
.tab.active { background: #2b7cdd; color: #fff; }
.activity-bar { margin: 12px 16px 0; padding: 10px 14px; border-radius: 8px; background: #fff8e1; color: #8a6100; font-size: 13px; border: 1px solid #ffe082; }
.activity-bar.ok { background: #e8f5e9; color: #2e7d32; border-color: #c8e6c9; }
.view { padding: 12px 16px; }
.card { background: #fff; border-radius: 10px; padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.card h3 { font-size: 15px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.field-full { grid-column: 1 / -1; }
.field span b { color: #e53935; }
.hint { font-size: 12px; color: #888; margin-top: 4px; }
.combo { position: relative; }
.combo-list { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #d5dbe2; border-radius: 6px; z-index: 20; max-height: 220px; overflow: auto; box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.combo-item { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid #f0f2f5; }
.combo-item:hover { background: #f0f6ff; }
.combo-item.add { color: #2b7cdd; font-weight: 600; }
.item-row { border: 1px solid #e3e8ee; border-radius: 8px; padding: 12px; margin-bottom: 10px; background: #fafbfc; }
.item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; }
.btn-mini { border: 1px solid #d5dbe2; background: #fff; border-radius: 5px; padding: 5px 10px; font-size: 12px; color: #444; }
.btn-mini:hover { background: #f2f6fb; }
.btn-mini.primary { background: #2b7cdd; border-color: #2b7cdd; color: #fff; }
.btn-mini.danger { color: #e53935; }
.btn-del { border: 0; background: none; color: #e53935; font-size: 12px; }
.btn-primary { width: 100%; background: #2b7cdd; color: #fff; border: 0; border-radius: 8px; padding: 13px; font-size: 16px; font-weight: 600; }
.btn-primary:disabled { background: #b9c8da; cursor: not-allowed; }
.filter-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.chip { border: 1px solid #d5dbe2; background: #fff; border-radius: 16px; padding: 6px 14px; font-size: 13px; }
.chip.active { background: #2b7cdd; border-color: #2b7cdd; color: #fff; }
.sem-block { margin-bottom: 16px; }
.sem-title { font-weight: 700; padding: 8px 0; font-size: 15px; }
.badge { background: #e8f5e9; color: #2e7d32; font-size: 11px; padding: 2px 7px; border-radius: 10px; margin-left: 6px; font-weight: 500; }
.my-item { background: #fff; border-radius: 8px; padding: 12px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.mi-main { flex: 1; min-width: 0; }
.mi-sub { font-size: 11px; color: #888; margin-top: 3px; }
.mi-action { white-space: nowrap; text-align: right; }
.btn-recv { background: #2b7cdd; color: #fff; border: 0; border-radius: 6px; padding: 7px 12px; font-size: 12px; }
.btn-undo { border: 0; background: none; color: #e53935; font-size: 12px; display: block; margin: 3px auto 0; }
.received { color: #2e7d32; font-size: 12px; }
.empty { text-align: center; color: #999; padding: 40px 0; }
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: rgba(30,35,45,.92); color: #fff; padding: 10px 20px; border-radius: 20px; z-index: 999; font-size: 13px; max-width: 90vw; text-align: center; }

/* ---- 后台 ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg,#e8f0fb,#f5f7fa); }
.login-card { width: 340px; background: #fff; border-radius: 12px; padding: 28px; box-shadow: 0 8px 30px rgba(0,0,0,.08); }
.login-card h2 { font-size: 19px; margin-bottom: 20px; text-align: center; }
.login-card .field { margin-bottom: 14px; }
.error-msg { color: #e53935; font-size: 13px; margin-top: 10px; text-align: center; }
.admin-shell { display: flex; min-height: 100vh; }
.sidebar { width: 190px; background: #1f2a3a; color: #cdd6e2; flex-shrink: 0; display: flex; flex-direction: column; }
.side-brand { font-size: 17px; font-weight: 700; color: #fff; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar nav { flex: 1; padding: 10px 0; }
.nav-item { display: block; width: 100%; text-align: left; border: 0; background: none; color: #cdd6e2; padding: 11px 18px; font-size: 14px; }
.nav-item:hover { background: rgba(255,255,255,.07); }
.nav-item.active { background: #2b7cdd; color: #fff; }
.logout { margin: 12px; border: 1px solid rgba(255,255,255,.25); background: none; color: #cdd6e2; border-radius: 6px; padding: 8px; }
.main { flex: 1; padding: 22px 26px; min-width: 0; overflow: auto; }
.page h2 { font-size: 20px; margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit,minmax(120px,1fr)); gap: 12px; margin-bottom: 18px; }
.kpis.compact { grid-template-columns: repeat(auto-fit,minmax(110px,1fr)); }
.kpi { background: #fff; border-radius: 10px; padding: 14px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.05); color: #777; font-size: 12px; }
.kpi-num { font-size: 24px; font-weight: 700; color: #222; margin-bottom: 3px; }
.kpi-num.ok, .ok-text { color: #2e7d32 !important; }
.kpi-num.warn, .warn-text { color: #d97706 !important; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 130px; }
.toolbar input[type=date] { min-width: 140px; }
.checkbox { display: flex; align-items: center; gap: 5px; font-size: 13px; }
.checkbox input { width: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.05); font-size: 13px; }
th { background: #f0f3f7; text-align: left; padding: 10px 12px; font-weight: 600; color: #555; white-space: nowrap; }
td { padding: 10px 12px; border-top: 1px solid #eef1f5; }
tr:hover td { background: #fafbfd; }
table input[type=checkbox] { width: 15px; height: 15px; margin: 0; cursor: pointer; accent-color: #2b6cb0; vertical-align: middle; }
.pager { margin-top: 14px; display: flex; gap: 8px; align-items: center; justify-content: center; font-size: 13px; color: #666; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-box { background: #fff; border-radius: 10px; padding: 22px; width: min(760px,92vw); max-height: 88vh; overflow: auto; }
.modal-box h3 { margin-bottom: 14px; font-size: 17px; }
.modal-box .field { margin-bottom: 10px; }
.modal-box textarea { width: 100%; margin-bottom: 10px; }
.modal-box > .btn-mini { margin-top: 14px; }
.filters { margin-bottom: 14px; }
.filters select { width: auto; min-width: 180px; }
.info-card { margin-bottom: 14px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 18px; }
.info-grid > div { display: flex; flex-direction: column; font-size: 13px; }
.info-grid span { color: #888; font-size: 12px; }
.info-grid b { font-weight: 600; }
.info-grid .info-full { grid-column: 1 / -1; }
.progress { width: 90px; height: 7px; background: #e9edf2; border-radius: 4px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 5px; }
.progress-bar { height: 100%; border-radius: 4px; }
.progress-bar.full { background: #43a047; }
.progress-bar.half { background: #fb8c00; }
.progress-bar.low { background: #e53935; }
.warn-badge { background: #fff3e0; color: #d97706; }
.btn-mini.danger-outline { border-color: #e53935; color: #e53935; }
.btn-mini.danger-outline:hover { background: #ffebee; }
@media (max-width: 600px) {
  .grid2 { grid-template-columns: 1fr; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
  .side-brand, .logout { display: none; }
  .sidebar nav { display: flex; padding: 0; }
  .nav-item { white-space: nowrap; padding: 12px; font-size: 12px; }
  .admin-shell { flex-direction: column; }
  .main { padding: 14px; }
  table { font-size: 12px; }
  th, td { padding: 7px 6px; }
}
