:root {
  --brand: #1f5eff;
  --brand-dark: #1444cc;
  --ok: #0aa06e;
  --warn: #f59e0b;
  --danger: #e5484d;
  --text: #16192b;
  --text-2: #5b6070;
  --text-3: #9aa0b0;
  --line: #e6e9f0;
  --bg: #f2f4f8;
  --card: #ffffff;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.view {
  min-height: 100vh;
}

/* ---------------- 通用控件 ---------------- */

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: #eef0f5;
  color: var(--text-2);
  transition: filter 0.15s ease;
}

.btn:hover {
  filter: brightness(0.96);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
}

.btn.ghost {
  background: #fff;
  color: var(--brand);
  border: 1px solid var(--brand);
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn.small {
  padding: 7px 14px;
  font-size: 13px;
}

.btn.block {
  width: 100%;
}

.error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin: 8px 0 0;
}

.hint {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.7;
  margin: 0 0 16px;
}

/* ---------------- 登录 ---------------- */

#view-login {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #1f5eff 0%, #163bb0 55%, #0f2547 100%);
}

.login-card {
  width: 340px;
  padding: 34px 30px 26px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(8, 20, 60, 0.35);
}

.brand {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
}

.brand-sub {
  color: var(--text-3);
  font-size: 13px;
  margin: 6px 0 24px;
}

.field-label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 8px;
}

#studentNo {
  width: 100%;
  padding: 12px 14px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 1px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfd;
  margin-bottom: 16px;
  outline: none;
}

#studentNo:focus {
  border-color: var(--brand);
  background: #fff;
}

/* ---------------- 控制台 ---------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  font-weight: 700;
}

.topbar-user {
  margin-left: 12px;
  color: var(--text-3);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 1fr);
  gap: 18px;
  padding: 22px 24px 40px;
  max-width: 1180px;
  margin: 0 auto;
}

@media (max-width: 860px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--card);
  border-radius: 14px;
  padding: 18px 20px 22px;
  box-shadow: 0 2px 12px rgba(22, 25, 43, 0.06);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-head h2 {
  font-size: 16px;
  margin: 0;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfd;
}

.session-title {
  font-weight: 600;
}

.session-sub {
  color: var(--text-3);
  font-size: 12px;
  margin-top: 2px;
}

.empty {
  color: var(--text-3);
  font-size: 13px;
  padding: 26px 0;
  text-align: center;
}

.import-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.file-btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--brand);
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
}

.file-name {
  font-size: 13px;
  color: var(--text-2);
}

.check {
  font-size: 13px;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.import-result {
  margin: 4px 0 0;
  padding: 12px 14px;
  background: #f6f8fc;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-2);
  white-space: pre-wrap;
  min-height: 20px;
}

/* ---------------- 投屏（深色） ---------------- */

#view-live {
  background: #0b1020;
  color: #fff;
}

.live-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.live-course {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 1px;
}

.live-sub {
  margin-top: 4px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.55);
}

.live-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-badge {
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(10, 160, 110, 0.16);
  color: #2ee6a8;
}

.live-badge.closed {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.6);
}

.live-main {
  display: flex;
  gap: 40px;
  padding: 36px 40px 40px;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .live-main {
    flex-direction: column;
  }
}

.live-left {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}

.qr-box {
  background: #fff;
  padding: 18px;
  border-radius: 18px;
  line-height: 0;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

#qr-canvas {
  width: 560px;
  height: 560px;
  image-rendering: pixelated;
}

.code-box {
  text-align: center;
}

.code-label {
  font-size: 15px;
  letter-spacing: 8px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 6px;
}

.code-digits {
  font-size: 96px;
  font-weight: 800;
  letter-spacing: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

.rotate {
  width: 560px;
  max-width: 100%;
}

.rotate-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.rotate-bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #2ee6a8, #5b8bff);
  transition: width 0.4s linear;
}

.rotate-text {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
}

.live-right {
  flex: 1 1 auto;
  min-width: 0;
}

.stats {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
}

.stat {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
}

.stat b {
  display: block;
  font-size: 34px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat span {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

.roster-head {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  margin: 14px 0 10px;
}

.people {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 26px;
}

.person {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 14px;
  background: rgba(46, 230, 168, 0.12);
  border: 1px solid rgba(46, 230, 168, 0.3);
}

.person.absent {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
}

.person .meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

.person .photo-btn-mini {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(91, 139, 255, 0.6);
  color: #9db9ff;
  cursor: pointer;
}

/* ---------------- 照片弹层 ---------------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 18, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  cursor: zoom-out;
  z-index: 50;
}

.modal img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-3);
  font-size: 12px;
  margin: 22px 0 16px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.pair-row {
  display: flex;
  gap: 10px;
}

#pairCode {
  flex: 1;
  padding: 11px 14px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 6px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfd;
  outline: none;
  min-width: 0;
}

#pairCode:focus {
  border-color: var(--brand);
  background: #fff;
}

.list-head {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 1px;
  margin: 14px 0 4px;
}

.list-head:first-child {
  margin-top: 0;
}

.live-remain {
  margin-left: 14px;
  color: rgba(255, 255, 255, 0.75);
}

/* 导出按钮：面板头与列表行里的小按钮组 */
.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session {
  gap: 8px;
}

.session > div:first-child {
  flex: 1;
  min-width: 0;
}

/* 代签：已到名单里的代签记录用蓝底区分，「撤回 / 代签」小按钮 */
.person.manual {
  background: rgba(91, 139, 255, 0.12);
  border-color: rgba(91, 139, 255, 0.45);
}

.person .photo-btn-mini.manual-btn {
  border-color: rgba(91, 139, 255, 0.6);
  color: #9db9ff;
}

.person .photo-btn-mini.cancel-btn {
  border-color: rgba(255, 176, 32, 0.6);
  color: #ffc766;
}

/* 出勤录入弹层：事假 / 病假 / 老师代签 */
#manual-modal {
  cursor: default;
}

.manual-card {
  width: 320px;
  padding: 22px;
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.manual-name {
  font-size: 18px;
  font-weight: 600;
}

.manual-tip {
  margin: 8px 0 18px;
  font-size: 12px;
  color: var(--text-2);
}

.manual-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 10px;
}

.manual-actions .btn {
  flex: 1;
}

/* 事假 / 病假：橙色系，与老师代签（蓝色）、普通签到（绿色）区分 */
.person.leave {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.45);
}

.person.absent {
  cursor: pointer;
}

/* ---------------- 名单与课表（tabs） ---------------- */

.tabs {
  display: flex;
  gap: 6px;
}

.tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-2);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}

.tab:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.tab-pane {
  padding-top: 8px;
}

.manage-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.manage-form input,
.manage-form select {
  height: 34px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  background: #fafbfd;
  color: var(--text);
}

.manage-form input {
  flex: 1 1 120px;
}

.manage-form select {
  flex: 0 1 auto;
  max-width: 170px;
}

.mini-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.mini-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fafbfd;
  font-size: 13px;
}

.mini-row .grow {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.mini-row .name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-row .sub {
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-row select {
  height: 30px;
  max-width: 130px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 6px;
  font-size: 12px;
  background: #fff;
}

.mini-empty {
  padding: 18px 0;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

.link-btn {
  border: none;
  background: none;
  color: var(--brand);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  white-space: nowrap;
}

.link-btn:hover {
  text-decoration: underline;
}

/* ---------------- 月历 ---------------- */

.cal-month {
  font-size: 15px;
  min-width: 86px;
  text-align: center;
}

.calendar {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
  background: #fff;
}

.cal-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f6f8ff;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-2);
  text-align: center;
  padding: 6px 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 88px;
}

.cal-cell {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 4px 5px;
  font-size: 11px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
}

.cal-cell:nth-child(7n) {
  border-right: none;
}

.cal-cell.blank {
  background: #fbfbfd;
  cursor: default;
}

.cal-cell.today {
  background: #f2f6ff;
}

.cal-cell.selected {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.cal-day {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 2px;
}

.cal-cell.today .cal-day {
  color: var(--brand);
}

.cal-item {
  border-radius: 4px;
  padding: 1px 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-item.plan {
  background: #eef2ff;
  color: var(--brand-dark);
}

.cal-item.done {
  background: #eaf7f1;
  color: #06694a;
}

.cal-item.pending {
  background: #fff4e0;
  color: #8a5a00;
}

.cal-more {
  color: var(--text-3);
  font-size: 10px;
}

.calendar-detail {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fafbfd;
  font-size: 13px;
  min-height: 44px;
  margin-bottom: 12px;
}

.calendar-detail h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-2);
}

.cal-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cal-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cal-line.sub {
  color: var(--text-3);
  font-size: 12px;
}

.cal-tag {
  font-size: 11px;
  border-radius: 999px;
  padding: 1px 8px;
  background: #eef2ff;
  color: var(--brand-dark);
}

.cal-tag.done {
  background: #eaf7f1;
  color: #06694a;
}

.schedule-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 4px;
}

.schedule-box summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 6px;
}

/* 原生时间 / 月份选择器：固定宽度，避免被 flex 拉长 */
.manage-form input[type='time'] {
  flex: 0 0 auto;
  width: 112px;
  padding: 0 8px;
}

.manage-form input.cal-month {
  flex: 0 0 auto;
  width: 152px;
  height: 34px;
  padding: 0 8px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  background: #fff;
}

/* ---------------- 多选删除 ---------------- */

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  border-radius: 10px;
  background: #eef2ff;
}

.bulk-info {
  flex: 1;
  font-size: 13px;
  color: var(--brand-dark);
}

.session.selectable {
  cursor: pointer;
}

.session.picked {
  border-color: var(--brand);
  background: #f5f8ff;
  box-shadow: 0 0 0 2px rgba(31, 94, 255, 0.12);
}

.row-check {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-right: 10px;
  accent-color: var(--brand);
  cursor: pointer;
}
