:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #2b2b2b;
  --muted: #8a8378;
  --brand: #e8743b;
  --brand-soft: #fbe9df;
  --green: #3aa76d;
  --green-soft: #e4f4ec;
  --line: #ece8e0;
  --shadow: 0 6px 20px rgba(60, 50, 40, 0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: 88px; }

.topbar {
  background: linear-gradient(135deg, #ef8a52, #e8743b);
  color: #fff;
  padding: 20px 18px 18px;
  border-radius: 0 0 22px 22px;
  box-shadow: var(--shadow);
}
.brand { font-size: 21px; font-weight: 700; letter-spacing: 1px; }
.subtitle { font-size: 13px; opacity: 0.9; margin-top: 2px; }

main { padding: 14px; }

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.card-title { font-size: 16px; font-weight: 700; margin: 0 0 12px; }
.card-head .card-title { margin: 0; }
.badge {
  background: var(--brand-soft); color: var(--brand);
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
}

.field { display: block; margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
select, input[type="text"], input[type="datetime-local"] {
  width: 100%; padding: 11px 12px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px; background: #faf9f6;
  color: var(--ink); outline: none;
}
/* 下拉框：保留原生选择行为，仅加可见箭头，避免看起来像普通输入框 */
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%238a8378' stroke-width='2' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 38px; cursor: pointer;
}
select:focus, input:focus { border-color: var(--brand); background: #fff; }

.student-list { display: flex; flex-direction: column; gap: 10px; }
.empty-hint { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 0; }

.student-row {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  background: #fcfbf8;
}
.stu-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.stu-name { font-weight: 600; font-size: 15px; }
.stu-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); display: none; }
.stu-thumb.show { display: block; }

.seg { display: flex; gap: 6px; margin-bottom: 8px; }
.seg-label { font-size: 12px; color: var(--muted); width: 56px; flex: none; align-self: center; }
.seg-btns { display: flex; flex: 1; background: #eee9e0; border-radius: 9px; padding: 3px; gap: 3px; }
.seg-btn {
  flex: 1; border: none; background: transparent; padding: 7px 0; border-radius: 7px;
  font-size: 13px; color: var(--muted); cursor: pointer; transition: .15s;
}
.seg-btn.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg.attendance .seg-btn.active { background: var(--green); color: #fff; }
.seg.attendance .seg-btn.active[data-val="请假"] { background: #d98a3c; }

.upload-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.upload-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; cursor: pointer;
  font-family: inherit;
  background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 600;
  padding: 7px 12px; border-radius: 9px; border: 1px dashed var(--brand);
}
.upload-btn.cam, .upload-btn.album { flex: 1 1 0; min-width: 96px; }
.upload-btn.armed { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.remove-img { border: none; background: none; color: var(--muted); font-size: 12px; cursor: pointer; text-decoration: underline; }

/* 添加补课学生 */
.add-student { display: flex; gap: 8px; margin-top: 14px; }
.add-student input { flex: 1; }
.add-student-btn {
  flex: none; border: 1px solid var(--brand); background: var(--brand-soft); color: var(--brand);
  font-size: 14px; font-weight: 600; padding: 0 14px; border-radius: 10px; cursor: pointer; white-space: nowrap;
}
.add-student-btn:active { transform: scale(.98); }
.add-hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; line-height: 1.4; }

/* 补课生标记与移除 */
.makeup-tag {
  font-size: 11px; font-weight: 600; color: #b06a1e; background: #fbeede;
  padding: 1px 7px; border-radius: 999px; margin-left: 6px;
}
.remove-stu {
  border: none; background: none; color: #c0584a; font-size: 12px; cursor: pointer;
  text-decoration: underline; margin-left: 8px; flex: none; white-space: nowrap;
}

/* 移除确认弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 60; display: flex;
  align-items: center; justify-content: center; padding: 24px;
  background: rgba(20, 18, 15, 0.45);
}
.modal-mask[hidden] { display: none; }
.modal {
  width: 100%; max-width: 320px; background: #fff; border-radius: 16px;
  padding: 20px 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  animation: modalPop .18s ease;
}
@keyframes modalPop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-text { margin: 0 0 18px; font-size: 15px; line-height: 1.6; color: var(--ink); white-space: pre-line; }
.modal-actions { display: flex; gap: 10px; }
.modal-btn {
  flex: 1; padding: 11px 0; border-radius: 10px; font-size: 15px; font-weight: 600;
  border: 1px solid var(--line); background: #faf9f6; color: var(--muted);
  cursor: pointer; font-family: inherit; transition: .15s;
}
.modal-btn.ok { background: #c0584a; border-color: #c0584a; color: #fff; }
.modal-btn:active { transform: scale(.98); }
.student-row.makeup { border-color: #f0d9b8; background: #fffaf2; }

.footer-bar {
  position: fixed; bottom: 0; left: 0; right: 0; padding: 12px 14px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); max-width: 480px; margin: 0 auto;
}
.submit-btn {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: var(--brand); color: #fff; font-size: 16px; font-weight: 700; cursor: pointer;
  transition: .15s;
}
.submit-btn:disabled { background: #d9d3c8; cursor: not-allowed; }
.submit-btn:active:not(:disabled) { transform: scale(.99); }

.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(.9);
  background: rgba(30,28,24,.92); color: #fff; padding: 14px 20px; border-radius: 12px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: 80%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.toast.ok { background: rgba(58,167,109,.95); }
.toast.err { background: rgba(200,70,55,.95); }
