@import url('app.css?v=20261104-account-avatar');
:root {
  --red: #a8201a;
  --red-dark: #7d1712;
  --ink: #1f1f1f;
  --muted: #6b6b6b;
  --line: #e6e1da;
  --bg: #faf8f5;
  --card: #ffffff;
  --ok: #2f7d4a;
  --radius: 8px;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }
button, input, textarea, select { accent-color: var(--red); }
.btn { white-space: nowrap; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font: 16px/1.75 var(--sans);
  color: var(--ink);
  background: var(--bg);
}
img { max-width: 100%; display: block; }
a { color: var(--red); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.3; margin: 0; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(250, 248, 245, .95);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-family: var(--serif); font-size: 20px; font-weight: 700; color: var(--red); text-decoration: none; }
.nav { display: flex; gap: 22px; }
.nav a { color: var(--ink); text-decoration: none; font-size: 15px; }
.nav a:hover { color: var(--red); }

/* 教师后台顶栏保持品牌、菜单和账号信息在一条清晰的横向基线上。 */
.app-site .topbar .wrap { min-height: 64px; height: auto; gap: 24px; align-items: center; }
.app-site .brand { flex: 0 1 350px; min-width: 0; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-site .brand span, .app-site .brand small { display: inline; }
.app-site .brand small { margin-left: 8px; color: var(--muted); font: 500 12px/1.3 var(--font); }
.app-site .nav { flex: 1 1 auto; min-width: 0; justify-content: flex-end; align-items: center; gap: 14px; flex-wrap: wrap; }
.app-site .nav a, .app-site .nav-account { white-space: nowrap; font-size: 13px; }
.app-site .nav-account { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }

/* 当前教学班与新增入口并列，避免加号掉到选择框下方。 */
.app-site .cohort-bar { display: grid; grid-template-columns: minmax(0, 1fr) 48px; align-items: end; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 20px; margin-bottom: 28px; }
.app-site .cohort-picker { display: grid; gap: 7px; min-width: 0; font-size: 13px; color: var(--muted); }
.app-site .cohort-picker select { width: 100%; min-width: 0; max-width: 100%; height: 44px; margin: 0; text-overflow: ellipsis; }
.app-site .cohort-add { display: grid; place-items: center; width: 48px; height: 44px; min-height: 44px; padding: 0; margin: 0; font-size: 24px; line-height: 1; }
.app-site .cohort-add:hover { background: #edf4fc; border-color: var(--red); }

/* ---------- 首屏 ---------- */
.hero { position: relative; color: #fff; background: #2a1a18 center / cover no-repeat; }
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(40, 10, 8, .85) 0%, rgba(40, 10, 8, .55) 55%, rgba(40, 10, 8, .25) 100%);
}
.hero .wrap { position: relative; padding: 110px 20px 96px; }
.hero .eyebrow { font-size: 14px; letter-spacing: .2em; opacity: .85; }
.hero h1 { font-size: 56px; letter-spacing: .08em; margin: 12px 0 14px; }
.hero p { font-size: 18px; max-width: 520px; opacity: .92; margin: 0 0 28px; }

.btn {
  display: inline-block; padding: 10px 22px; border-radius: var(--radius);
  font: inherit; font-size: 15px; text-decoration: none; cursor: pointer;
  border: 1px solid var(--red); background: var(--red); color: #fff;
}
.btn:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn.ghost { background: transparent; color: var(--red); }
.btn.ghost:hover { background: rgba(168, 32, 26, .06); }
.hero .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .7); }
.hero .btn.ghost:hover { background: rgba(255, 255, 255, .12); }
.btn + .btn { margin-left: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 5px 12px; font-size: 14px; }
.btn.danger { background: transparent; color: #b3261e; border-color: #d9a29e; }

/* ---------- 区块 ---------- */
section.block { padding: 72px 0; border-bottom: 1px solid var(--line); }
section.block:last-of-type { border-bottom: 0; }
.sec-title { display: flex; align-items: baseline; gap: 12px; margin-bottom: 28px; }
.sec-title h2 { font-size: 30px; }
.sec-title span { color: var(--muted); font-size: 14px; letter-spacing: .1em; }
.sec-title h2::before {
  content: ""; display: inline-block; width: 4px; height: 24px; background: var(--red);
  margin-right: 12px; vertical-align: -3px;
}
.lead { font-size: 17px; max-width: 760px; margin: 0 0 32px; }

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.pillar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.pillar h3 { font-size: 19px; margin-bottom: 8px; }
.pillar p { margin: 0; color: var(--muted); font-size: 15px; }

.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.split img { border-radius: var(--radius); }
.steps { list-style: none; padding: 0; margin: 20px 0 28px; counter-reset: s; }
.steps li { counter-increment: s; padding: 8px 0 8px 40px; position: relative; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 9px;
  width: 26px; height: 26px; border-radius: 50%; background: var(--red); color: #fff;
  font-size: 14px; text-align: center; line-height: 26px;
}

/* ---------- 活动纪实 ---------- */
.posts { display: grid; gap: 24px; }
.post {
  display: grid; grid-template-columns: 300px 1fr; gap: 24px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.post img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 3 / 2; }
.post .body { padding: 20px 24px 20px 0; }
.post time { color: var(--muted); font-size: 14px; }
.post h3 { font-size: 20px; margin: 4px 0 8px; }
.post p { margin: 0 0 10px; color: #444; font-size: 15px; }
.post a { font-size: 14px; }
.post.text-only { grid-template-columns: 1fr; }
.post.text-only .body { padding: 20px 24px; }

.footer { padding: 32px 0 40px; color: var(--muted); font-size: 14px; }
.footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ---------- 表单通用 ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
label.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], textarea, select {
  width: 100%; font: inherit; padding: 10px 12px;
  border: 1px solid #d6d0c7; border-radius: 6px; background: #fff;
}
label.field > input:not([type]), input[type=url], input[type=search] {width:100%;font:inherit;padding:10px 12px;border:1px solid #d6d0c7;border-radius:6px;background:#fff;}
.app-site label.field > input:not([type]),.app-site input[type=url],.app-site input[type=search]{border-color:#cfdeed;border-radius:5px;font-size:14px}
input:focus, textarea:focus { outline: 2px solid rgba(168, 32, 26, .25); border-color: var(--red); }
textarea { resize: vertical; min-height: 90px; }
.msg { margin: 12px 0 0; font-size: 14px; min-height: 1.4em; }
.msg.err { color: #b3261e; }
.msg.ok { color: var(--ok); }

/* ---------- 签到页（手机） ---------- */
.checkin-page { max-width: 480px; margin: 0 auto; padding: 24px 16px 48px; }
.checkin-page header { text-align: center; margin-bottom: 20px; }
.checkin-page header .brand { font-size: 22px; }
.checkin-page h1 { font-size: 22px; margin-top: 6px; }
.checkin-page .sub { color: var(--muted); font-size: 14px; }
.photo-box {
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  border: 1px dashed #c9c1b6; border-radius: var(--radius); min-height: 180px;
  cursor: pointer; color: var(--muted); background: #fdfcfa; overflow: hidden;
}
.photo-box img { width: 100%; max-height: 360px; object-fit: cover; }
.photo-box input { display: none; }
.stars { display: flex; gap: 6px; }
.stars button {
  font-size: 28px; line-height: 1; background: none; border: 0; padding: 2px; cursor: pointer; color: #d6d0c7;
}
.stars button.on { color: #d99a1e; }
.checkin-page .btn.block { display: block; width: 100%; padding: 13px; font-size: 17px; }
.done { text-align: center; padding: 40px 10px; }
.done .tick {
  width: 72px; height: 72px; border-radius: 50%; background: var(--ok); color: #fff;
  font-size: 40px; line-height: 72px; margin: 0 auto 16px;
}

/* ---------- 后台 ---------- */
.admin-main { padding: 28px 0 60px; }
.admin-main h1 { font-size: 24px; margin-bottom: 20px; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row label.field { margin-bottom: 0; flex: 1; min-width: 160px; }
table { width: 100%; border-collapse: collapse; background: var(--card); font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 14px; background: #f5f2ee; white-space: nowrap; }
td .thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; }
.tag { display: inline-block; font-size: 13px; padding: 1px 8px; border-radius: 10px; background: #eee; color: #555; }
.tag.on { background: #e3f1e7; color: var(--ok); }
.stats { display: flex; gap: 32px; margin: 8px 0 20px; }
.stats b { font-size: 26px; font-family: var(--serif); display: block; }
.stats span { color: var(--muted); font-size: 14px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar .btn + .btn { margin-left: 0; }
.gap { height: 28px; }
.tag.leave { background: #fdf1dc; color: #9a6510; }
.tag.off { background: #f3e3e1; color: #b3261e; }
.attendance-state { color: #b3261e; font-weight: 600; }
.attendance-state.is-present { color: var(--ok); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.admin-main h2 { font-size: 19px; margin: 0 0 14px; }
.sub-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.sub-head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 16px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--red); }

/* 课堂照片 */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.gallery .ph { position: relative; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: #eee; }
.gallery .ph button {
  position: absolute; top: 6px; right: 6px; border: 0; border-radius: 4px; cursor: pointer;
  background: rgba(0, 0, 0, .6); color: #fff; font-size: 13px; padding: 2px 8px;
}

/* 未签到名单 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  font: inherit; font-size: 14px; padding: 4px 10px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.chips button:hover { border-color: var(--red); color: var(--red); }

/* 课次签到名单：两列密集展示，每页最多 10 人 */
.attendance-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.attendance-column { min-width: 0; }
.attendance-column-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.attendance-column-head h2 { margin: 0; font-size: 17px; }
.attendance-column .chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-height: 40px; align-content: start; }
.attendance-column .chips button, .attendance-person { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); text-align: left; font-size: 13px; }
.attendance-column .chips button small, .attendance-person small { flex-shrink: 0; color: var(--muted); font-size: 11px; }
.attendance-column .chips button span, .attendance-person span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attendance-pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; min-height: 30px; color: var(--muted); font-size: 12px; }
.attendance-pager button { min-height: 30px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); cursor: pointer; }
.attendance-pager button:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.attendance-pager button:disabled { opacity: .45; cursor: default; }

/* 出勤矩阵 */
.att th, .att td { text-align: center; padding: 8px 6px; white-space: nowrap; font-size: 14px; }
.att th:nth-child(-n+2), .att td:nth-child(-n+2) { text-align: left; }
.att th a { color: inherit; text-decoration: none; }
.att td.present { color: var(--ok); }
.att td.leave { color: #9a6510; background: #fdf8ee; }
.att td.absent { color: #b3261e; background: #fbefee; }
.att .low { color: #b3261e; font-weight: 600; }
.att th small { display: block; font-weight: 400; }

/* 微专业公开页：上课记录 */
.lessons { display: grid; gap: 20px; }
.lesson-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.lesson-card .meta { color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.lesson-card h3 { font-size: 20px; margin: 6px 0 10px; }
.lesson-card .txt { white-space: pre-wrap; margin: 0 0 12px; color: #333; font-size: 15px; }
.lesson-card .label { font-size: 14px; color: var(--muted); margin: 12px 0 2px; }
.lesson-card .gallery { margin-top: 14px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.course-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 40px; }
.course-info div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.course-info b { font-family: var(--serif); font-size: 26px; display: block; }
.course-info span { color: var(--muted); font-size: 14px; }

/* 投屏二维码 */
.projector {
  position: fixed; inset: 0; z-index: 100; background: #fff;
  display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.projector.show { display: flex; }
.projector h2 { font-size: 36px; margin-bottom: 8px; }
.projector .hint { color: var(--muted); font-size: 18px; }
.projector img { width: min(62vh, 80vw); height: auto; margin: 20px 0; image-rendering: pixelated; }
.projector .count { font-size: 22px; }
.projector .count b { color: var(--red); font-size: 40px; font-family: var(--serif); }
.projector .close { position: absolute; top: 20px; right: 24px; }

@media (max-width: 760px) {
  .app-site .topbar .wrap { display: block; padding-top: 14px; padding-bottom: 0; }
  .app-site .brand { display: block; max-width: 100%; margin-bottom: 10px; font-size: 18px; }
  .app-site .brand span, .app-site .brand small { display: inline; }
  .app-site .nav { justify-content: flex-start; flex-wrap: nowrap; gap: 18px; max-width: 100%; overflow-x: auto; padding-bottom: 12px; white-space: nowrap; }
  .app-site .nav-account { flex: 0 0 auto; }
  .app-site .cohort-bar { grid-template-columns: minmax(0, 1fr) 48px; gap: 10px; }
  .nav { gap: 14px; }
  .nav a { font-size: 14px; }
  .nav .hide-sm { display: none; }
  .hero .wrap { padding: 72px 20px 64px; }
  .hero h1 { font-size: 40px; }
  .hero p { font-size: 16px; }
  section.block { padding: 52px 0; }
  .sec-title h2 { font-size: 24px; }
  .grid3, .split { grid-template-columns: 1fr; }
  .post { grid-template-columns: 1fr; gap: 0; }
  .post .body { padding: 16px 18px; }
  .table-wrap { overflow-x: auto; }
  .attendance-columns { grid-template-columns: 1fr; gap: 22px; }
  .attendance-column .chips { grid-template-columns: 1fr 1fr; }
  .grid2, .grid4, .course-info { grid-template-columns: 1fr; }
  .lesson-card { padding: 18px; }
}
.table-wrap { overflow-x: auto; }

.record-export-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 8px; }
@media (max-width: 639px) { .record-export-actions { flex-direction: column; align-items: stretch; } }

.lesson-delete { border: 0; background: transparent; color: #a52f2f; padding: 8px; font: inherit; cursor: pointer; }
.lesson-delete:hover { text-decoration: underline; }
.lesson-delete:focus-visible, .account-avatar:focus-visible { outline: 2px solid #245d9b; outline-offset: 2px; }
.lesson-delete:disabled { opacity: .5; cursor: wait; }
.app-site .account-avatar { color: #8793a1; background: transparent; border-color: transparent; }
.app-site .account-avatar:hover, .app-site .account-menu[open] .account-avatar { color: #245d9b; background: #edf4fc; border-color: #b9cde2; }
.app-site .nav .account-identity span { display: block; max-width: none; }

@media (max-width: 760px) {
  .app-site .topbar .wrap:has(.account-menu) { position: relative; }
  .app-site .topbar .wrap:has(.account-menu) .brand { max-width: calc(100% - 52px); overflow: visible; }
  .app-site .nav:has(.account-menu) { overflow: visible; flex-wrap: wrap; }
  .app-site .nav .account-menu { position: absolute; right: 18px; top: 10px; }
  .app-site .nav .account-avatar { width: 44px; height: 44px; }
  .app-site .nav .account-dropdown { right: 0; }
  .app-site .nav.teaching-nav .account-dropdown a { justify-content: flex-start; }
  .app-site .lesson-table-wrap:before { content: none; }
  .app-site .lesson-table-wrap .lesson-table { min-width: 0; }
  .lesson-table thead { display: none; }
  .lesson-table, .lesson-table tbody, .lesson-table tr, .lesson-table td { display: block; width: 100%; }
  .lesson-table tr { border: 1px solid var(--line); background: #fff; margin-bottom: 12px; }
  .app-site .lesson-table td { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 4px 10px; padding: 8px 12px; border: 0; white-space: normal !important; overflow-wrap: anywhere; }
  .lesson-table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; }
  .lesson-table .lesson-delete { min-height: 44px; margin: -8px; }
}
