:root {
  --primary: #1b4f9c;
  --primary-dark: #143a73;
  --primary-light: #e8f0fb;
  --accent: #c8a15a;
  --text: #1f2733;
  --text-2: #5a6675;
  --text-3: #8b95a3;
  --border: #d8dee7;
  --border-2: #e6ebf2;
  --bg: #f2f5f9;
  --card: #ffffff;
  --danger: #c0392b;
  --success: #2e7d5b;
  --warn: #b8860b;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 33, 58, .06), 0 1px 3px rgba(16, 33, 58, .08);
  --shadow: 0 4px 16px rgba(16, 33, 58, .09);
  --shadow-lg: 0 12px 40px rgba(16, 33, 58, .14);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  background: linear-gradient(135deg, #10305e 0%, #1b4f9c 55%, #2a6bbf 100%);
}
.login-brand {
  color: #fff;
  padding: 64px 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-brand::after {
  content: "";
  position: absolute;
  right: -120px; bottom: -160px;
  width: 460px; height: 460px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
}
.login-brand .badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .22);
  padding: 6px 14px; border-radius: 999px;
  font-size: 12.5px; letter-spacing: .5px; width: fit-content;
}
.login-brand h1 {
  font-size: 38px; line-height: 1.35; margin: 26px 0 16px;
  letter-spacing: 2px; font-weight: 700;
}
.login-brand p { color: rgba(255, 255, 255, .8); font-size: 15px; line-height: 1.9; max-width: 460px; margin: 0; }
.login-brand ul { list-style: none; padding: 0; margin: 34px 0 0; color: rgba(255, 255, 255, .82); font-size: 13.5px; }
.login-brand li { padding: 7px 0; display: flex; gap: 10px; align-items: flex-start; }
.login-brand li::before { content: "◆"; color: var(--accent); font-size: 9px; line-height: 22px; }

.login-panel {
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.login-card { width: 100%; max-width: 356px; }
.login-card h2 { font-size: 22px; margin-bottom: 6px; }
.login-card .sub { color: var(--text-3); font-size: 13px; margin-bottom: 28px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border);
  border-radius: 8px; outline: none; background: #fbfcfe; transition: .16s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(27, 79, 156, .1);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
  background: var(--primary); color: #fff; cursor: pointer;
  font-weight: 500; transition: .16s; white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; padding: 12px; }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn.soft { background: var(--primary-light); color: var(--primary); }
.btn.soft:hover { background: #dbe8fb; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #a93226; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.xs { padding: 4px 9px; font-size: 12.5px; border-radius: 6px; }
.login-tip { margin-top: 18px; font-size: 12.5px; color: var(--text-3); text-align: center; }
.link-btn { background: none; border: none; color: var(--primary); cursor: pointer; padding: 0; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

/* ---------- 应用框架 ---------- */
.app-header {
  background: linear-gradient(100deg, #12325f 0%, #1b4f9c 100%);
  color: #fff;
  padding: 0 28px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 40;
  box-shadow: 0 2px 12px rgba(16, 33, 58, .18);
}
.app-header .logo { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 600; letter-spacing: 1px; }
.app-header .logo .mark {
  width: 30px; height: 30px; border-radius: 7px; background: rgba(255, 255, 255, .16);
  display: grid; place-items: center; font-size: 14px; border: 1px solid rgba(255, 255, 255, .25);
}
.nav { display: flex; gap: 4px; margin-left: 30px; }
.nav button {
  background: transparent; border: none; color: rgba(255, 255, 255, .78);
  padding: 8px 15px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.nav button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.nav button.active { background: rgba(255, 255, 255, .18); color: #fff; font-weight: 500; }
.header-right { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.user-chip { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .12); padding: 5px 12px 5px 6px; border-radius: 999px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: #fff; color: var(--primary); display: grid; place-items: center; font-weight: 600; font-size: 12.5px; }
.header-right .link-btn { color: rgba(255, 255, 255, .8); font-size: 13px; }
.header-right .link-btn:hover { color: #fff; }

.page { max-width: 1320px; margin: 0 auto; padding: 22px 24px 60px; }
.page.narrow { max-width: 1240px; }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-2); margin-bottom: 18px;
}
.card-head {
  padding: 15px 20px; border-bottom: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.card-head h3 { font-size: 15.5px; display: flex; align-items: center; gap: 9px; }
.card-head h3::before { content: ""; width: 3px; height: 15px; background: var(--primary); border-radius: 2px; }
.card-body { padding: 18px 20px; }
.card-body.tight { padding: 12px 16px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.input, .select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; outline: none; transition: .16s;
}
.input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27, 79, 156, .1); }
.input.search { min-width: 240px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow: auto; }
.table-wrap.scroll { max-height: 64vh; border: 1px solid var(--border-2); border-radius: 8px; }
table.data {
  width: 100%; border-collapse: collapse; font-size: 13.5px; background: #fff;
}
table.data th {
  background: #f6f8fb; color: var(--text-2); font-weight: 600; text-align: left;
  padding: 10px 12px; border-bottom: 1px solid var(--border-2); white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
table.data tbody tr:hover { background: #f9fbfd; }
table.data td.c, table.data th.c { text-align: center; }
.muted { color: var(--text-3); }
.empty { padding: 46px 20px; text-align: center; color: var(--text-3); }
.empty .big { font-size: 30px; margin-bottom: 10px; opacity: .5; }

.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px;
  background: #eef2f7; color: var(--text-2);
}
.tag.excellent { background: #eaf5ef; color: #2e7d5b; }
.tag.good { background: #e9f1fb; color: #1b4f9c; }
.tag.mid { background: #fdf4e3; color: #a9761b; }
.tag.pass { background: #f6f0e8; color: #8a6d3b; }
.tag.fail { background: #fdecea; color: #c0392b; }
.tag.role-admin { background: #f3e9f7; color: #7a3d94; }

/* ---------- 听课表（A4 版式） ---------- */
.sheet-outer { overflow-x: auto; padding: 4px 0 10px; }
.sheet {
  width: 100%; max-width: 940px; margin: 0 auto; background: #fff;
  padding: 24px 26px 18px; box-shadow: var(--shadow); border: 1px solid var(--border-2);
}
.sheet h2.sheet-title {
  text-align: center; font-size: 20px; letter-spacing: 1px; margin-bottom: 14px; font-weight: 700;
}
table.eval { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12.5px; }
table.eval td {
  border: 1px solid #333; padding: 4px 6px; vertical-align: middle; line-height: 1.6;
}
table.eval td.title-cell { border: none; padding: 0 0 10px; }
table.eval td.c { text-align: center; }
table.eval td.head { background: #f4f5f7; font-weight: 600; text-align: center; }
table.eval td.gray { background: #fafbfc; }
.cell-input {
  border: none; background: transparent; padding: 2px 3px; width: 100%; outline: none;
  font-size: 12.5px; border-bottom: 1px dashed transparent;
}
.cell-input:hover { background: #f4f7fb; }
.cell-input:focus { background: #eef4fd; border-bottom-color: var(--primary); }
.cell-input.score { width: 46px; text-align: center; border: 1px solid var(--border); border-radius: 4px; padding: 2px 0; display: block; margin: 0 auto; }
.cell-input.inline { width: auto; min-width: 46px; display: inline-block; }
.cell-input.date { width: 128px; }
.cell-textarea {
  width: 100%; border: none; outline: none; resize: vertical; font-size: 12.5px;
  line-height: 1.7; padding: 3px; background: transparent; min-height: 74px;
}
.cell-textarea:focus { background: #f7faff; }
.grade-line { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12.5px; }
.grade-line label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.total-strong { font-weight: 700; font-size: 14px; }
.note { font-size: 12px; color: var(--text-3); margin-top: 8px; }

/* 照片 */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo-item { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: #f5f7fa; aspect-ratio: 4/3; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-item .del {
  position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; border: none; cursor: pointer; line-height: 1; font-size: 14px;
}
.photo-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.upload-hint { font-size: 12.5px; color: var(--text-3); margin-top: 10px; }

/* 汇总表 */
.summary-wrap { overflow: auto; max-height: 68vh; border: 1px solid var(--border-2); border-radius: 8px; }
table.summary { border-collapse: collapse; font-size: 12px; background: #fff; min-width: 1180px; }
table.summary th, table.summary td { border: 1px solid #cfd6e0; padding: 6px 8px; text-align: center; vertical-align: middle; }
table.summary th { background: #f4f6f9; font-weight: 600; color: #3a4757; position: sticky; top: 0; z-index: 2; }
table.summary td.left { text-align: left; }
table.summary tbody tr:nth-child(even) { background: #fbfcfe; }
.summary-title { text-align: center; font-size: 16px; font-weight: 700; padding: 12px; }
.summary-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); padding: 0 4px 10px; }

/* 管理后台 */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border-2); padding: 0 20px; }
.tabs button {
  background: none; border: none; padding: 12px 14px; cursor: pointer; color: var(--text-2);
  border-bottom: 2px solid transparent; font-size: 14px;
}
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: #fff; border: 1px solid var(--border-2); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.stat .k { color: var(--text-3); font-size: 12.5px; }
.stat .v { font-size: 26px; font-weight: 700; color: var(--primary); margin-top: 6px; letter-spacing: 0.5px; }
.stat .v small { font-size: 13px; color: var(--text-3); font-weight: 400; margin-left: 4px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 33, 58, .45); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 460px; box-shadow: var(--shadow-lg);
  max-height: 88vh; overflow: auto;
}
.modal.wide { max-width: 720px; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border-2); font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border-2); display: flex; justify-content: flex-end; gap: 10px; }
.close-x { float: right; background: none; border: none; font-size: 18px; color: var(--text-3); cursor: pointer; }

.toast {
  position: fixed; top: 74px; left: 50%; transform: translateX(-50%);
  background: #22303f; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 13.5px; z-index: 200; box-shadow: var(--shadow); opacity: 0; transition: .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.err { background: #a93226; }

.code-box {
  font-family: Consolas, "Courier New", monospace; background: #f5f7fa;
  border: 1px dashed var(--border); border-radius: 8px; padding: 10px 12px;
  letter-spacing: 2px; font-size: 15px; text-align: center; color: var(--primary-dark);
}
.help { font-size: 12.5px; color: var(--text-3); line-height: 1.8; }
.help b { color: var(--text-2); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.divider { height: 1px; background: var(--border-2); margin: 18px 0; }

.breadcrumb { font-size: 13px; color: var(--text-3); margin-bottom: 14px; }
.breadcrumb a { color: var(--text-2); }

@media (max-width: 980px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .nav { margin-left: 0; overflow-x: auto; }
  .app-header { padding: 0 14px; }
  .page { padding: 16px 14px 60px; }
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .sheet { padding: 14px 10px; }
  .header-right .user-name { display: none; }
}

@media print {
  .app-header, .no-print, .card-head .toolbar { display: none !important; }
  body { background: #fff; }
  .page { max-width: none; padding: 0; }
  .card { box-shadow: none; border: none; }
  .sheet { box-shadow: none; border: none; max-width: none; }
}
