:root {
  --primary: #2f6bff;
  --primary-dark: #1e4fd6;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #7a849e;
  --border: #e5e9f2;
  --green: #18a058;
  --orange: #e8830c;
  --red: #d9363e;
  --blue-gray: #5b7db1;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.hidden { display: none !important; }

/* ---- 顶栏 ---- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 56px;
}
.brand { font-weight: 700; font-size: 17px; white-space: nowrap; }
.nav { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.nav a {
  padding: 6px 14px; border-radius: 8px; color: var(--muted);
  text-decoration: none; font-weight: 500; white-space: nowrap;
}
.nav a.active, .nav a:hover { background: #eef3ff; color: var(--primary); }
.userbox { display: flex; gap: 12px; align-items: center; color: var(--muted); white-space: nowrap; }
.userbox b { color: var(--text); }
.link { color: var(--primary); cursor: pointer; text-decoration: none; }

.view { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }

/* ---- 卡片 ---- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.card h3 { font-size: 15px; margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat .num { font-size: 28px; font-weight: 700; }
.stat .lbl { color: var(--muted); margin-top: 2px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

/* ---- 按钮/表单 ---- */
button, .btn {
  display: inline-block; border: none; cursor: pointer; font-size: 14px;
  background: var(--primary); color: #fff; padding: 9px 18px;
  border-radius: 9px; font-weight: 500; text-decoration: none; text-align: center;
}
button:hover, .btn:hover { background: var(--primary-dark); }
button.ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
button.ghost:hover { border-color: var(--primary); color: var(--primary); background: #fff; }
button.danger { background: var(--red); }
button.warn { background: var(--orange); }
button.success { background: var(--green); }
button.big { padding: 13px 26px; font-size: 16px; border-radius: 11px; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  font-size: 14px; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 9px; background: #fff; color: var(--text); outline: none; font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; color: var(--muted); margin-bottom: 5px; font-size: 13px; }
label.field input, label.field select, label.field textarea { width: 100%; }

/* ---- 表格 ---- */
table.tbl { width: 100%; border-collapse: collapse; background: #fff; }
.tbl th, .tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px; white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 500; background: #fafbfd; }
.tbl tr:hover td { background: #f7faff; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }

/* ---- 状态徽章 ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge.normal { background: #e6f7ef; color: var(--green); }
.badge.late { background: #fdf1e0; color: var(--orange); }
.badge.absent { background: #fdebec; color: var(--red); }
.badge.leave { background: #e8eefc; color: var(--blue-gray); }
.badge.pending { background: #f0f1f5; color: var(--muted); }
.badge.both, .badge.face, .badge.location { background: #eef3ff; color: var(--primary); }
.badge.warn { background: #fdebec; color: var(--red); }
.badge.ok { background: #e6f7ef; color: var(--green); }

/* ---- 登录页（左品牌面板 + 右登录卡） ---- */
.login-wrap { min-height: 100vh; display: flex; background: #eef1f6; }
.login-brand {
  flex: 1.15; background: #17365f; color: #fff;
  padding: 14vh 5vw; display: flex; flex-direction: column; justify-content: center;
}
.brand-title { font-size: 30px; font-weight: 700; letter-spacing: 2px; }
.brand-sub { margin-top: 12px; color: #a9bcd8; font-size: 14.5px; }
.brand-list { margin-top: 44px; list-style: none; }
.brand-list li { padding: 12px 0 12px 24px; position: relative; color: #d5dff0; font-size: 15px; border-bottom: 1px solid rgba(255,255,255,.10); }
.brand-list li::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 8px; height: 8px; background: #4d8bff; border-radius: 2px; }
.brand-foot { margin-top: 48px; color: #7f95b5; font-size: 12.5px; letter-spacing: 1px; }
.login-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.login-card { width: 400px; max-width: 94vw; background: #fff; border: 1px solid #e3e8f0; border-radius: 10px; padding: 34px 32px; box-shadow: 0 6px 24px rgba(23,54,95,.08); }
.login-card h1 { font-size: 20px; margin-bottom: 4px; color: #17365f; }
.login-card .sub { color: var(--muted); margin-bottom: 24px; font-size: 13.5px; }
.demo-accounts { margin-top: 18px; border-top: 1px dashed var(--border); padding-top: 14px; }
.demo-accounts .row { gap: 8px; }
.demo-accounts button { padding: 6px 10px; font-size: 12px; }

/* ---- 签到页 ---- */
.step { display: flex; gap: 12px; margin-bottom: 14px; align-items: flex-start; }
.step-no {
  width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; margin-top: 2px;
}
.step-no.done { background: var(--green); }
.step-no.skip { background: #c3cad9; }
.video-box {
  position: relative; width: 100%; max-width: 460px; aspect-ratio: 4/3;
  background: #10131c; border-radius: 14px; overflow: hidden; margin: 0 auto;
}
.video-box video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.video-box .guide {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.video-box .guide .oval {
  width: 52%; aspect-ratio: 3/4; border: 3px dashed rgba(255,255,255,.75); border-radius: 50%;
}
.video-box .challenge {
  position: absolute; top: 14px; left: 0; right: 0; text-align: center;
  color: #fff; font-size: 24px; font-weight: 700; text-shadow: 0 2px 10px rgba(0,0,0,.7);
  pointer-events: none;
}

.countdown { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---- 邮件正文 ---- */
.mail-body { background: #fafbfd; border: 1px solid var(--border); border-radius: 10px; padding: 16px; overflow-x: auto; }

/* ---- Toast/Modal ---- */
.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  background: #23293a; color: #fff; padding: 11px 22px; border-radius: 10px;
  font-size: 14px; z-index: 200; box-shadow: 0 8px 30px rgba(0,0,0,.25); max-width: 80vw;
}
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 20, 35, .45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 14px; padding: 24px; width: 560px; max-width: 96vw;
  max-height: 86vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal h3 { margin-bottom: 16px; }

/* ---- 投屏模式 ---- */
.screen-overlay {
  position: fixed; inset: 0; background: #101728; color: #fff; z-index: 300;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 30px; padding: 40px;
}
.screen-overlay .huge { font-size: 96px; font-weight: 800; }
.screen-overlay .huge small { font-size: 30px; font-weight: 400; color: #93a0bd; }
.screen-overlay .names { font-size: 22px; color: #dfe6f5; line-height: 1.9; text-align: center; max-width: 70vw; }
.screen-overlay .quit { position: absolute; right: 30px; top: 26px; background: rgba(255,255,255,.12); }

/* ---- 进度条 ---- */
.progress { height: 10px; background: #edf0f7; border-radius: 6px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #2f6bff, #18a058); border-radius: 6px; }

/* ---- 空状态 ---- */
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---- 人脸页双栏 ---- */
.face-grid { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }

/* ---- 移动端适配 ---- */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 14px; gap: 6px 12px; }
  .brand { font-size: 16px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; padding-bottom: 2px; }
  .nav a { padding: 6px 12px; white-space: nowrap; }
  .userbox { margin-left: auto; font-size: 13px; }
  .view { padding: 14px 12px 50px; }
  .card { padding: 14px; border-radius: 10px; }
  .stat { padding: 12px 14px; }
  .stat .num { font-size: 22px; }
  .grid.c2 { grid-template-columns: 1fr !important; }
  .grid.c4 { grid-template-columns: repeat(2, 1fr) !important; }
  .face-grid { grid-template-columns: 1fr; }
  button.big { padding: 11px 18px; font-size: 15px; }
  .login-card { padding: 26px 20px; border-radius: 14px; }
  .modal { padding: 18px 16px; }
  .modal .row > label.field { min-width: 100%; }
  .row { gap: 8px; flex-wrap: wrap; }
  /* 表单控件在手机上收窄换行，杜绝横向溢出 */
  .row > input:not([type="checkbox"]):not([type="radio"]),
  .row > select,
  .row > textarea { flex: 1 1 100%; min-width: 0; width: auto; }
  .row > input[style*="width"], .row > select[style*="width"] { flex: 1 1 calc(50% - 8px); }
  .row > button, .row > .btn, .row > label.btn { flex: 0 0 auto; }
  .nav { flex-wrap: nowrap; }
  .tbl-wrap { -webkit-overflow-scrolling: touch; }
  .grid > .card { min-width: 0; }
  .tbl th, .tbl td { padding: 8px; font-size: 12.5px; }
  .countdown { font-size: 24px !important; }
  /* 登录页手机端：隐藏品牌面板，登录卡全宽 */
  .login-brand { display: none; }
  .login-wrap { background: #eef1f6; }
  /* 表格：允许横向滑动，压缩字号 */
  .tbl-wrap { -webkit-overflow-scrolling: touch; }
  .tbl { font-size: 12px; min-width: 520px; }
  .tbl th, .tbl td { padding: 6px; }
  /* 页面级表单字段不再挤成一条 */
  .row > label.field { min-width: calc(50% - 8px); }
  .btn, button { white-space: nowrap; }
  .video-box { max-width: 100%; }
  .step { gap: 8px; }
  .stat { padding: 12px; }
  .topbar { padding: 8px 12px; }
  .brand { font-size: 16px; }
}

/* ---- 页脚备案号 ---- */
.site-footer { text-align: center; padding: 18px 0 26px; color: var(--muted); font-size: 12.5px; }
.site-footer a { color: var(--muted); text-decoration: none; }
