/* ============================================================
   课时记录 · 书房纸感
   暖纸底 + 宋体标题 + 朱砂(作文)/墨绿(阅读) 双色
   纯 CSS、仅系统字体,无外部依赖
   ============================================================ */
:root {
  --paper: #f4efe4;
  --paper-2: #ebe3d4;
  --card: #fffdf8;
  --ink: #211c16;
  --ink-2: #4f473b;
  --muted: #8b8171;
  --line: #e5dbc8;
  --line-2: #d7c9ae;
  --seal: #b3402f;          /* 朱砂:作文 / 主操作 */
  --seal-ink: #8f3223;
  --seal-soft: #f7e5df;
  --jade: #2f6b57;          /* 墨绿:阅读 / 记课 */
  --jade-soft: #e1eee8;
  --amber: #96682a;         /* 赭:请假 / 待办 */
  --amber-soft: #f7edda;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(58, 44, 24, .05), 0 10px 26px -16px rgba(58, 44, 24, .45);
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, "Roboto Mono", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--paper);
  /* 极淡的作文格 + 两团色晕,营造纸面氛围 */
  background-image:
    radial-gradient(circle at 16% 10%, rgba(179, 64, 47, .045), transparent 40%),
    radial-gradient(circle at 88% 82%, rgba(47, 107, 87, .05), transparent 44%),
    repeating-linear-gradient(0deg, rgba(120, 100, 70, .04) 0 1px, transparent 1px 30px);
  min-height: 100vh;
}

/* ---------------- 顶栏 ---------------- */
nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 14px 10px 12px;
  color: #fff;
}
nav.h5 { background: linear-gradient(180deg, #33735d, var(--jade)); }
nav.admin { background: linear-gradient(180deg, #33454c, #26363c); }
nav a {
  color: rgba(255, 255, 255, .88); text-decoration: none; font-size: 14.5px;
  padding: 4px 2px; border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
nav a:hover { color: #fff; border-bottom-color: rgba(255, 255, 255, .55); }
nav .right { margin-left: auto; }
.brand {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex: 0 0 26px;
  font-family: var(--serif); font-size: 16px; font-weight: 700; color: #fff;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 6px;
}

a { color: var(--jade); text-decoration: none; }
a:hover { text-decoration: underline; }
a.plain-link { color: inherit; }

/* ---------------- 版心 ---------------- */
main { padding: 18px 14px 48px; max-width: 720px; margin: 0 auto; }
main.wide { max-width: 1080px; }

h1 {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-size: 24px; font-weight: 700;
  letter-spacing: .03em; margin: 4px 0 16px;
}
h1::after {
  content: ""; flex: 1; height: 1px; min-width: 20px;
  background: linear-gradient(90deg, var(--line-2), transparent);
}
h2 { font-family: var(--serif); font-size: 17px; margin: 22px 0 8px; letter-spacing: .02em; }
h3 { font-family: var(--serif); font-size: 16.5px; font-weight: 700; margin: 0 0 6px; letter-spacing: .02em; }
h4 { margin: 12px 0 4px; font-size: 14px; color: var(--ink-2); }

.muted { color: var(--muted); font-size: 13px; }
.warn { color: var(--seal); font-variant-numeric: tabular-nums; }
.ok { color: var(--jade); }

/* ---------------- 卡片 ---------------- */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
@media (prefers-reduced-motion: no-preference) {
  .card { animation: rise .42s cubic-bezier(.2, .7, .3, 1) both; }
  .card:nth-of-type(2) { animation-delay: .04s; }
  .card:nth-of-type(3) { animation-delay: .08s; }
  .card:nth-of-type(4) { animation-delay: .12s; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}

/* 课次卡:左侧色条按内容区分(阅读=墨绿 / 作文=朱砂) */
.slot { padding-left: 18px; }
.slot::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--line-2);
}
.slot.c-阅读::before { background: var(--jade); }
.slot.c-作文::before { background: var(--seal); }

.slot-head { font-size: 16px; font-weight: 600; letter-spacing: .01em; }
.slot-time { font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.slot-names { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.tag {
  font-family: var(--sans); font-size: 11px; font-weight: 600; color: var(--ink-2);
  background: var(--paper-2); border: 1px solid var(--line-2);
  border-radius: 5px; padding: 0 5px; margin-left: 6px; vertical-align: 1px;
}
.slot-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }

/* 周课表:每天一段 */
.day { margin-bottom: 14px; }
.day-head {
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--serif); font-size: 15px; font-weight: 700;
  padding-bottom: 6px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.day-head .date { font-family: var(--mono); font-size: 12.5px; font-weight: 400; color: var(--muted); }
.day-slot { position: relative; padding: 5px 0 5px 12px; }
.day-slot::before {
  content: ""; position: absolute; left: 0; top: 13px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--line-2);
}
.day-slot.c-阅读::before { background: var(--jade); }
.day-slot.c-作文::before { background: var(--seal); }

/* ---------------- 状态小标 ---------------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12.5px; white-space: nowrap; border: 1px solid transparent;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.chip-ok { background: var(--jade-soft); color: var(--jade); }
.chip-idle { background: var(--paper-2); color: var(--amber); }
.chip-leave { background: var(--amber-soft); color: var(--amber); }
.chip-warn { background: var(--seal-soft); color: var(--seal-ink); }

/* ---------------- 按钮 ---------------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 600; font-size: 14.5px;
  min-height: 40px; padding: 9px 16px;
  color: #fff; background: var(--seal); cursor: pointer; text-decoration: none;
  border: 1px solid transparent; border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 6px 16px -10px rgba(143, 50, 35, .85);
  transition: transform .12s ease, box-shadow .2s ease, filter .2s ease, background .2s ease;
}
button:hover, .btn:hover { filter: brightness(1.06); }
button:active, .btn:active { transform: translateY(1px); }
.btn-jade, button.jade { background: var(--jade); box-shadow: 0 6px 16px -10px rgba(47, 107, 87, .9); }
.plain, button.plain, .btn.plain {
  background: var(--paper-2); color: var(--ink-2);
  border-color: var(--line-2); box-shadow: none;
}
.plain:hover, button.plain:hover { background: #e2d8c4; filter: none; }
button.danger, .btn.danger {
  background: #fff; color: var(--seal-ink); border-color: rgba(179, 64, 47, .45); box-shadow: none;
}
button.danger:hover { background: var(--seal-soft); filter: none; }

/* 拍照按钮 */
label.cam { background: var(--jade); box-shadow: 0 6px 16px -10px rgba(47, 107, 87, .9); padding: 10px 18px; }
label.cam input { display: none; }
label.cam:active { transform: translateY(1px); }

/* ---------------- 表单 ---------------- */
input, select, textarea {
  font: inherit; color: var(--ink); max-width: 100%;
  padding: 8px 10px; margin: 2px 0;
  background: #fff; border: 1px solid var(--line-2); border-radius: 10px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--jade);
  box-shadow: 0 0 0 3px rgba(47, 107, 87, .16);
}
label { color: var(--ink-2); }
form.inline { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 0; }
.searchbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.searchbar .cond { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.searchbar .cond input { width: 130px; margin: 0; }
.count-line { margin: -6px 0 10px; font-size: 13px; }
.count-line b { font-variant-numeric: tabular-nums; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }

/* ---------------- 提示条 ---------------- */
.msg {
  padding: 10px 16px; font-size: 14px;
  background: var(--amber-soft); color: #6d4a12;
  border-bottom: 1px solid var(--line-2);
}

/* ---------------- 表格 ---------------- */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; background: var(--card); font-size: 14px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
thead th {
  font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--ink-2);
  background: var(--paper-2); border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
thead th:first-child { border-top-left-radius: 10px; }
thead th:last-child { border-top-right-radius: 10px; }
tbody tr:hover { background: #fffaee; }
td.ops { white-space: nowrap; }
td.ops button { margin-right: 4px; }
.num { font-variant-numeric: tabular-nums; }
td input, td select { padding: 5px 8px; }
td input.num { width: 62px; }

table.compact { width: auto; min-width: min(100%, 400px); }

/* 学员表列宽 */
table.students th:nth-child(1) { width: 22%; }
table.students th:nth-child(2) { width: 12%; }
table.students th:nth-child(3),
table.students th:nth-child(4) { width: 13%; }
table.students th:last-child { width: 150px; }

/* ---------------- 分页 / 行布局 ---------------- */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 14px; margin-top: 12px; font-size: 14px; }
.pager a { color: var(--jade); font-weight: 600; text-decoration: none; }
.pager a:hover { text-decoration: underline; }

/* ---------------- 照片 ---------------- */
.thumb {
  width: 74px; height: 74px; object-fit: cover; vertical-align: middle;
  margin: 3px 4px 0 0; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--paper-2);
  transition: transform .18s ease, box-shadow .18s ease;
}
a:hover > .thumb { transform: translateY(-2px); box-shadow: 0 8px 18px -10px rgba(58, 44, 24, .6); }
.rec { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.rec:last-child { border-bottom: 0; }

/* ---------------- 弹窗 ---------------- */
dialog {
  width: min(92vw, 380px); padding: 18px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 24px 60px -24px rgba(40, 30, 10, .6);
}
dialog::backdrop { background: rgba(32, 27, 22, .45); backdrop-filter: blur(2px); }
dialog h3 { margin: 0 0 12px; }
dialog p { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
dialog input, dialog select { flex: 1; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin: 16px 0 0; }

/* ---------------- 登录 / 空态 ---------------- */
.center-card { max-width: 340px; margin: 12vh auto 0; text-align: center; }
.seal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; margin-bottom: 10px;
  font-family: var(--serif); font-size: 26px; font-weight: 700; color: #fff;
  background: var(--seal); border-radius: 10px;
  box-shadow: 0 8px 20px -12px rgba(143, 50, 35, .9);
}
.empty { text-align: center; color: var(--muted); padding: 22px 0; font-size: 14px; }

/* ---------------- 小屏微调 ---------------- */
@media (max-width: 420px) {
  main { padding: 14px 12px 44px; }
  h1 { font-size: 21px; }
  .slot-head { font-size: 15px; }
  .thumb { width: 64px; height: 64px; }
}

/* ---------------- 记课表单 ---------------- */
.stu-list { list-style: none; padding: 0; margin: 8px 0 0; }
.stu-list li { border-bottom: 1px dashed var(--line); }
.stu-list li:last-child { border-bottom: 0; }
.stu-list label { display: flex; align-items: center; gap: 8px; padding: 10px 2px; cursor: pointer; }
.stu-list input[type=checkbox] { width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--jade); }
.stu-name { font-weight: 600; }
.modes { display: flex; gap: 8px; margin: 12px 0 0; }
.modes .mode {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px; background: #fff; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 10px; transition: .18s ease;
}
.modes .mode input { width: 16px; height: 16px; accent-color: var(--jade); }
.modes .mode.on { border-color: var(--jade); background: var(--jade-soft); color: var(--jade); font-weight: 600; }
.modes .mode.off-disabled { opacity: .45; }
.field-note { color: var(--muted); font-size: 13px; margin-left: 8px; }
.center-card h1 { justify-content: center; }
.center-card h1::after { display: none; }
.full { width: 100%; }
.submit-row { margin: 14px 0 4px; }
.home-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.home-card a { color: var(--jade); text-decoration: none; font-weight: 600; }
.arrow { color: var(--line-2); font-size: 18px; }

/* ---------------- 课表管理 ---------------- */
details.card { padding: 12px 16px; }
details.card > summary {
  cursor: pointer; font-family: var(--serif); font-size: 16px; font-weight: 700;
  color: var(--ink); list-style: none;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "  ▾"; color: var(--muted); font-size: 12px; }
details.card[open] > summary { margin-bottom: 10px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
details.card[open] > summary::after { content: "  ▴"; }

.group-card .ops { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.group-card .ops form { display: inline-flex; margin: 0; }
.ov-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.ov { display: flex; align-items: center; gap: 8px; }
.ov form { margin: 0; }
button.tiny { min-height: 0; padding: 2px 10px; font-size: 12.5px; border-radius: 999px; }

.form-row { display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 8px 0; }
.form-row label { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.pick-filter { width: 100%; margin: 4px 0 6px; }
.pick {
  max-height: 290px; overflow-y: auto; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; padding: 4px 10px;
  -webkit-overflow-scrolling: touch;
}
.pick label {
  display: flex; align-items: center; gap: 8px; padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.pick label:last-child { border-bottom: 0; }
.pick input[type=checkbox] { width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--jade); }
.pick .stu-name { flex: 1; }
.pick select { padding: 4px 6px; }

/* 课程组表格 */
table.groups { table-layout: fixed; min-width: 900px; }
table.groups th:nth-child(1) { width: 17%; }
table.groups th:nth-child(2) { width: 13%; }
table.groups th:nth-child(3) { width: 21%; }
table.groups th:nth-child(4) { width: 9%; }
table.groups th:nth-child(5) { width: 18%; }
table.groups th:nth-child(6) { width: 210px; }
table.groups td { white-space: normal; overflow-wrap: anywhere; }
table.groups td:nth-child(2) { white-space: nowrap; }
table.groups td:nth-child(4) { white-space: nowrap; }
table.groups .ops { display: flex; gap: 6px; }
table.groups .ops button, table.groups .ops .btn {
  min-height: 32px; padding: 5px 10px; font-size: 13px; white-space: nowrap;
}
.ov-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--amber-soft); color: var(--amber);
  border-radius: 999px; padding: 1px 4px 1px 10px; margin: 1px 2px; font-size: 12.5px;
}
.ov-tag form { margin: 0; }
.ov-tag button.tiny { padding: 0 7px; background: transparent; color: var(--amber); font-weight: 700; }

.home-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 760px) { .home-grid { grid-template-columns: 1fr 1fr; } }
.home-grid .card { margin-bottom: 0; }

/* ---------------- 页脚 · 备案 ---------------- */
.site-footer {
  margin: 26px auto 18px; padding: 0 16px;
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted);
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink-2); text-decoration: underline; }
.site-footer .sep { color: var(--line-2); }
.site-footer .gongan { display: inline-flex; align-items: center; gap: 4px; }
.site-footer .gongan img { width: 14px; height: auto; display: block; }
