/* 教务后台样式：沉稳墨绿主色 + 暖橙辅色，系统字体，无外部资源 */
:root {
  --green-900: #1f4d3a;
  --green-700: #2f6b4f;
  --green-600: #3a7d5c;
  --green-100: #e6f1eb;
  --green-50:  #f2f8f4;
  --orange-600: #d97706;
  --orange-100: #fdeed8;
  --ink: #1f2933;
  --ink-2: #52606d;
  --ink-3: #7b8794;
  --line: #e2e6e9;
  --bg: #f5f6f4;
  --card: #ffffff;
  --red: #c0392b;
  --red-100: #fbeae8;
  --gray-100: #eceff1;
  --shadow: 0 1px 3px rgba(31, 41, 51, 0.10);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
}

a { color: var(--green-700); text-decoration: none; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--green-900) 0%, var(--green-700) 60%, var(--green-600) 100%);
  padding: 24px;
}
.login-card {
  width: 380px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  padding: 36px 32px;
}
.login-card h1 {
  font-size: 22px;
  margin: 0 0 6px;
  color: var(--green-900);
  text-align: center;
}
.login-card .sub {
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
  margin-bottom: 26px;
}
.login-card .field { margin-bottom: 18px; }
.login-card label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--ink-2); }
.login-card input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  outline: none;
}
.login-card input:focus { border-color: var(--green-600); }
.login-error {
  min-height: 20px;
  color: var(--red);
  font-size: 13px;
  margin: 4px 0 10px;
}

/* ---------- 主框架 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 228px;
  background: var(--green-900);
  color: #dcebe2;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.sidebar .brand {
  padding: 20px 18px 16px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  line-height: 1.4;
}
.sidebar .brand small { display: block; font-size: 12px; font-weight: 400; color: #a9c9b8; margin-top: 4px; }
.menu { padding: 12px 10px; flex: 1; overflow-y: auto; }
.menu a {
  display: block;
  padding: 11px 14px;
  border-radius: 8px;
  color: #dcebe2;
  font-size: 15px;
  margin-bottom: 4px;
}
.menu a:hover { background: rgba(255,255,255,0.08); }
.menu a.active { background: var(--green-600); color: #fff; font-weight: 600; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 60px;
  background: var(--card);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.topbar .page-title { font-size: 17px; font-weight: 700; color: var(--green-900); }
.topbar .user-box { display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--ink-2); }
.topbar .user-box .role-tag {
  background: var(--orange-100);
  color: var(--orange-600);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.content { padding: 22px 24px; flex: 1; overflow-x: auto; }

/* ---------- 卡片 / 工具条 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}
.filter-bar .field { display: flex; flex-direction: column; gap: 5px; }
.filter-bar label { font-size: 13px; color: var(--ink-2); }
.filter-bar input, .filter-bar select {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  min-width: 150px;
  background: #fff;
  outline: none;
}
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--green-600); }
.filter-actions { display: flex; gap: 10px; margin-left: auto; align-items: flex-end; }

/* ---------- 按钮 ---------- */
.btn {
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  background: var(--gray-100);
  color: var(--ink);
  white-space: nowrap;
}
.btn:hover { filter: brightness(0.96); }
.btn.primary { background: var(--green-700); color: #fff; }
.btn.primary:hover { background: var(--green-600); }
.btn.orange { background: var(--orange-600); color: #fff; }
.btn.danger { background: var(--red-100); color: var(--red); }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 6px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.grid th, table.grid td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
table.grid th {
  background: var(--green-50);
  color: var(--green-900);
  font-weight: 600;
  white-space: nowrap;
}
table.grid tr:hover td { background: #fafcfb; }
table.grid td .sub { color: var(--ink-3); font-size: 12.5px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 状态徽标 ---------- */
.badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 12px;
  font-size: 12.5px;
  white-space: nowrap;
}
.badge.green  { background: var(--green-100); color: var(--green-700); }
.badge.orange { background: var(--orange-100); color: var(--orange-600); }
.badge.red    { background: var(--red-100); color: var(--red); }
.badge.gray   { background: var(--gray-100); color: var(--ink-2); }
.badge.blue   { background: #e3eef7; color: #2b6a99; }

/* ---------- 概览卡片 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.stat-card .label { color: var(--ink-2); font-size: 14px; margin-bottom: 10px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--green-900); }
.stat-card .value .unit { font-size: 14px; font-weight: 400; color: var(--ink-3); margin-left: 4px; }

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  justify-content: flex-end;
  color: var(--ink-2);
  font-size: 14px;
}
.pager button { min-width: 34px; }

/* ---------- 提示状态 ---------- */
.state-tip {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
}
.state-tip.error { color: var(--red); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(31, 41, 51, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.modal {
  background: var(--card);
  border-radius: 12px;
  width: 520px;
  max-width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.25);
}
.modal-head {
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 17px; color: var(--green-900); }
.modal-close { cursor: pointer; font-size: 22px; color: var(--ink-3); line-height: 1; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 16px 22px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 13.5px; color: var(--ink-2); }
.form-field label .req { color: var(--red); }
.form-field input, .form-field select, .form-field textarea {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #fff;
}
.form-field textarea { height: auto; padding: 10px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--green-600); }
.form-error { color: var(--red); font-size: 13px; margin: 8px 0 0; min-height: 18px; }

.detail-list { display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; font-size: 14px; }
.detail-list dt { color: var(--ink-3); }
.detail-list dd { margin: 0; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 10px; }
.mini-table th, .mini-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.mini-table th { background: var(--green-50); color: var(--green-900); }

.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green-900);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  z-index: 200;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
.toast.error { background: var(--red); }

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