﻿:root {
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #7a8194;
  --line: #e6e8ef;
  --ok: #16a34a;
  --warn: #f59e0b;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(20, 25, 40, .06);
}

* { 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;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
}
.login-hero {
  background: linear-gradient(140deg, #4f46e5 0%, #7c3aed 55%, #2563eb 100%);
  color: #fff; padding: 64px; display: flex; flex-direction: column; justify-content: center;
}
.login-hero h1 { font-size: 34px; line-height: 1.35; margin-bottom: 18px; letter-spacing: 1px; }
.login-hero p { opacity: .85; line-height: 1.9; max-width: 420px; }
.login-hero ul { margin-top: 28px; list-style: none; }
.login-hero li { opacity: .9; margin: 10px 0; padding-left: 22px; position: relative; }
.login-hero li::before { content: "✓"; position: absolute; left: 0; color: #a5f3fc; }
.login-box { display: flex; align-items: center; justify-content: center; padding: 40px; background: #fff; }
.login-form { width: 100%; max-width: 360px; }
.login-form h2 { font-size: 24px; margin-bottom: 6px; }
.login-form .sub { color: var(--muted); margin-bottom: 28px; font-size: 13px; }
.login-tip { margin-top: 18px; font-size: 12px; color: var(--muted); line-height: 1.8; background: #f8f9ff; padding: 12px; border-radius: 8px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: #1e2233; color: #c9cede; padding: 22px 14px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.logo .dot { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #6366f1, #22d3ee); }
.logo b { color: #fff; font-size: 15px; letter-spacing: .5px; }
.nav a {
  display: flex; align-items: center; gap: 10px; color: #c9cede; padding: 11px 12px;
  border-radius: 9px; margin-bottom: 4px; font-size: 13.5px; transition: .15s;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: var(--brand); color: #fff; }
.nav .icon { width: 18px; text-align: center; }
.sidebar .foot { margin-top: auto; font-size: 12px; color: #6b7185; padding: 0 8px; }

.main { flex: 1; min-width: 0; }
.topbar {
  height: 62px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 26px;
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 17px; font-weight: 600; }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #eef0ff; color: var(--brand); display: grid; place-items: center; font-weight: 600; }
.content { padding: 24px 26px 60px; }

/* ---------- 组件 ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card h3 { font-size: 15px; margin-bottom: 14px; font-weight: 600; }
.stat { display: flex; flex-direction: column; gap: 8px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 700; letter-spacing: .5px; }
.stat .value small { font-size: 14px; color: var(--muted); font-weight: 400; }
.stat .hint { font-size: 12px; color: var(--muted); }

button.btn {
  border: 0; border-radius: 9px; padding: 9px 16px; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 13.5px; transition: .15s;
}
button.btn:hover { background: var(--brand-dark); }
button.btn:disabled { opacity: .55; cursor: not-allowed; }
button.btn.ghost { background: #eef0ff; color: var(--brand); }
button.btn.ghost:hover { background: #e0e3ff; }
button.btn.danger { background: #fee2e2; color: var(--danger); }
button.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }

input, select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 13.5px; font-family: inherit; background: #fff; color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(79,70,229,.09); }
label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; margin-bottom: 6px; font-size: 13px; color: #4a5065; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; background: #fafbfd; font-size: 12.5px; }
tbody tr:hover { background: #fafbff; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; }
.tag.ok { background: #dcfce7; color: #15803d; }
.tag.late { background: #fef3c7; color: #b45309; }
.tag.absent { background: #fee2e2; color: #b91c1c; }
.tag.leave { background: #e0e7ff; color: #4338ca; }
.tag.makeup { background: #cffafe; color: #0e7490; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }

.camera-box { position: relative; background: #0f1220; border-radius: 12px; overflow: hidden; aspect-ratio: 4/3; display: grid; place-items: center; }
.camera-box video, .camera-box canvas { width: 100%; height: 100%; object-fit: cover; }
.camera-box .placeholder { color: #6b7185; font-size: 13px; text-align: center; padding: 20px; line-height: 1.8; }
.camera-hint { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.55); color: #fff; font-size: 12px; padding: 5px 12px; border-radius: 20px; }

.progress { height: 8px; border-radius: 20px; background: #eceefa; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #22d3ee); border-radius: 20px; transition: width .3s; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 13px; }
.toast {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  background: #1f2430; color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 13px; z-index: 99; opacity: 0; transition: .25s; pointer-events: none;
}
.toast.show { opacity: 1; top: 32px; }
.toast.err { background: #b91c1c; }

.modal-mask { position: fixed; inset: 0; background: rgba(15,18,32,.45); display: grid; place-items: center; z-index: 20; }
.modal { background: #fff; border-radius: 14px; padding: 24px; width: 440px; max-width: 92vw; max-height: 86vh; overflow: auto; }
.modal h3 { margin-bottom: 16px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.bar-row .name { width: 90px; color: var(--muted); }
.bar-row .track { flex: 1; height: 10px; background: #f0f2fa; border-radius: 10px; overflow: hidden; }
.bar-row .track > i { display: block; height: 100%; background: linear-gradient(90deg,#6366f1,#38bdf8); }
.bar-row .val { width: 52px; text-align: right; color: #4a5065; }

/* ---- 周课表 ---- */
.muted { color: var(--muted); font-size: 13px; }
.tt-wrap { overflow-x: auto; margin: 0 -4px; }
.tt { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; min-width: 760px; }
.tt th { background: #f7f9fc; font-weight: 600; font-size: 13px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.tt th.tt-period { width: 76px; color: var(--muted); font-weight: 500; font-size: 12px; }
.tt th.tt-today { background: #eef4ff; color: var(--brand); }
.tt td { border-right: 1px solid #eef1f6; border-bottom: 1px solid #eef1f6; height: 60px; }
.tt td:first-child { border-left: 1px solid #eef1f6; }
.tt .tt-cell { cursor: pointer; transition: background .12s; }
.tt .tt-cell:hover { background: #f5f9ff; }
.tt .tt-block { position: relative; vertical-align: top; padding: 7px 9px; cursor: pointer; border-radius: 6px; }
.tt .tt-block:hover { filter: brightness(.97); }
.tt .tt-name { font-weight: 600; font-size: 13px; color: #1f2430; line-height: 1.35; }
.tt .tt-meta { font-size: 12px; color: #5d6473; margin-top: 3px; }
.tt .tt-time { font-size: 12px; color: #8a91a3; margin-top: 2px; }
.tt .tt-del { position: absolute; top: 3px; right: 5px; border: 0; background: rgba(255,255,255,.75);
  color: #9aa1b1; width: 18px; height: 18px; line-height: 16px; border-radius: 50%; cursor: pointer; font-size: 13px; }
.tt .tt-del:hover { background: var(--danger); color: #fff; }

/* ---- 集中签到大屏 ---- */
.kiosk { position: fixed; inset: 0; background: #0f1420; color: #e8ecf5; display: flex; flex-direction: column; z-index: 50; }
.kiosk-head { display: flex; align-items: center; gap: 18px; padding: 16px 26px; border-bottom: 1px solid #1d2636; }
.kiosk-title { font-size: 20px; font-weight: 600; letter-spacing: 1px; }
.kiosk-clock { color: #8ea0bd; font-family: Consolas, monospace; font-size: 16px; }
.kiosk-exit { margin-left: auto; color: #8ea0bd; font-size: 13px; text-decoration: none; border: 1px solid #2a3547; padding: 6px 14px; border-radius: 8px; }
.kiosk-exit:hover { color: #fff; border-color: #4f5b74; }
.kiosk-body { flex: 1; display: grid; grid-template-columns: 1.35fr 1fr; gap: 22px; padding: 22px 26px; min-height: 0; }
.kiosk-cam { position: relative; background: #05080f; border-radius: 16px; overflow: hidden; }
.kiosk-cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.kiosk-scrim { position: absolute; inset: 0; box-shadow: inset 0 0 0 2px rgba(79,70,229,.35); border-radius: 16px; }
.kiosk-side { display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.kiosk-banner { border-radius: 16px; padding: 26px 22px; text-align: center; transition: background .2s; background: #16203a; }
.kiosk-banner.ok { background: linear-gradient(160deg, #14532d, #166534); }
.kiosk-banner.err { background: linear-gradient(160deg, #7f1d1d, #991b1b); }
.kiosk-banner.warn { background: linear-gradient(160deg, #78350f, #92400e); }
.kiosk-banner .k-emoji { font-size: 44px; line-height: 1; margin-bottom: 10px; }
.kiosk-banner .k-text { font-size: 22px; font-weight: 600; line-height: 1.5; }
.kiosk-count { color: #8ea0bd; font-size: 15px; text-align: center; }
.kiosk-count b { font-size: 26px; color: #fff; }
.kiosk-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; background: #121a2a; border-radius: 14px; }
.kiosk-list li { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid #1b2434; font-size: 15px; }
.kiosk-list li:last-child { border-bottom: 0; }
.kiosk-list .k-name { flex: 1; font-weight: 600; }
.kiosk-list .k-status.ok { color: #4ade80; font-size: 13px; }
.kiosk-list .k-status.late { color: #fbbf24; font-size: 13px; }
.kiosk-list .k-time { color: #7b8aa4; font-size: 13px; font-family: Consolas, monospace; }
.kiosk-list .empty-li { color: #6b7a93; justify-content: center; }

/* ---- 扫码签到（手机） ---- */
body:has(.qrpage) { background: #0f1420; }
.qrpage { min-height: 100vh; padding: 18px 16px 28px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.qr-head { color: #e8ecf5; font-size: 18px; font-weight: 600; letter-spacing: 1px; }
.qr-cam { position: relative; width: 100%; max-width: 520px; aspect-ratio: 4 / 3; background: #05080f; border-radius: 18px; overflow: hidden; }
.qr-cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.qr-hint { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px; text-align: center; color: #cfd8e6; font-size: 13px; background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.qr-btn { width: 100%; max-width: 520px; padding: 16px; border: 0; border-radius: 14px; background: #4f46e5; color: #fff; font-size: 17px; font-weight: 600; }
.qr-btn:disabled { opacity: .6; }
.qr-result { width: 100%; max-width: 520px; text-align: center; padding: 16px; border-radius: 14px; color: #cfd8e6; }
.qr-result.ok { background: #14532d; }
.qr-result.err { background: #7f1d1d; }
.qr-result .q-name { font-size: 24px; font-weight: 700; color: #fff; margin-bottom: 6px; }
.qr-result .q-sub { font-size: 13.5px; color: #cfe9d8; }

/* ---- 二维码弹窗 ---- */
.qr-modal { text-align: center; }
.qr-img { width: 260px; height: 260px; border-radius: 10px; background: #fff; padding: 8px; }

.qr-img-wrap { display: flex; justify-content: center; min-height: 260px; align-items: center; color: #9aa1b1; font-size: 13px; }

body:has(.kiosk) { background: #0f1420; overflow: hidden; }

/* ---- 签到页顶部提醒 ---- */
.sign-hint { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 14px 18px; font-size: 14px; }
.sign-hint .sign-remain { margin-left: auto; color: var(--muted); font-size: 13px; }
.sign-hint .sign-remain b { color: var(--danger); font-size: 16px; }
.sign-dot { width: 9px; height: 9px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 4px rgba(22,163,74,.15); animation: signPulse 1.6s infinite; }
@keyframes signPulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.sign-hint.ended .sign-dot.gray { background: #9aa1b1; box-shadow: 0 0 0 4px rgba(154,161,177,.15); animation: none; }
.sign-hint.ended { color: #5a6072; }
.photo-tip { color: #5a6072; font-size: 13px; line-height: 1.9; background: #f7f9fc; border-radius: 10px; padding: 14px 16px; }

/* ---- 返回键 ---- */
.topbar h1 { display: flex; align-items: center; gap: 10px; }
.back-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: 8px; background: #f0f2f7; color: #4a5163; text-decoration: none; font-size: 16px; line-height: 1; }
.back-btn:hover { background: #e4e8f2; color: #1f2430; }

/* ---- 识别评估 ---- */
.ev-tip { color: #5a6072; font-size: 13px; line-height: 1.9; }
.ev-tip code { background: #f2f4f9; border-radius: 4px; padding: 1px 5px; font-size: 12px; color: #4b5563; }
.ev-chart { width: 100%; height: auto; display: block; margin-top: 8px; }
.ev-legend { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #6b7280; flex-wrap: wrap; }
.ev-legend .dot-g, .ev-legend .dot-r, .ev-legend .dot-b { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ev-legend .dot-g { background: #34d399; }
.ev-legend .dot-r { background: #f87171; }
.ev-legend .dot-b { background: #3b82f6; }
.ev-legend .dot-r, .ev-legend .dot-b { margin-left: 14px; }

/* ---- 代签异常 ---- */
.row-bad td { background: #fff7f7; }
.row-bad td:first-child { box-shadow: inset 3px 0 0 #ef4444; }
.bad-tag { background: #fee2e2; color: #b91c1c; }
.reason { font-size: 12px; color: #b45309; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #4b5563; }
.chk input { width: auto; }

/* ---- 随机抽查 ---- */
.roll-alert { border-left: 4px solid #f59e0b; display: flex; align-items: center; gap: 12px; margin-bottom: 16px; font-size: 14px; }
.roll-alert .btn { margin-left: auto; }
.rc-list, .ap-list { list-style: none; margin: 0; padding: 0; }
.rc-list li, .ap-list li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid #eef1f6; font-size: 13.5px; }
.rc-list li:last-child, .ap-list li:last-child { border-bottom: 0; }
.rc-list li span, .ap-list li .muted { color: #8a91a3; font-size: 12.5px; }
.rc-list li i { margin-left: auto; font-style: normal; font-size: 12.5px; }
.rc-list .rc-pending i { color: #b45309; }
.rc-list .rc-ok i { color: #15803d; }
.rc-list .rc-late i { color: #b91c1c; }
.ap-list li i { margin-left: auto; font-style: normal; font-size: 12.5px; }
.ap-list li i.ok { color: #15803d; }
.ap-list li i.bad { color: #b91c1c; }
.ap-list li span { color: #5a6072; }
.qr-input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; }

/* ---------- 手机端：侧边栏改为顶部横向导航 ---------- */
@media (max-width: 860px) {
  .layout { display: block; }
  .sidebar {
    width: auto; height: auto; position: sticky; top: 0; z-index: 20;
    flex-direction: row; align-items: center; gap: 8px;
    padding: 8px 10px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  .sidebar .logo { padding: 0; flex: 0 0 auto; }
  .sidebar .logo b { display: none; }
  .sidebar .logo .dot { width: 24px; height: 24px; border-radius: 7px; }
  .sidebar .foot { display: none; }
  .nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
  .nav a {
    flex: 0 0 auto; margin: 0; padding: 7px 10px; font-size: 13px;
    white-space: nowrap; border-radius: 8px;
  }
  .nav a .icon { width: auto; }
  .main { width: 100%; }
  .topbar { height: auto; padding: 10px 14px; gap: 8px; flex-wrap: wrap; }
  .topbar h1 { font-size: 15px; }
  .user-chip { gap: 8px; font-size: 12px; }
  .user-chip > span { display: none; }
  .content { padding: 12px 12px 40px; }
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  .card h3 { font-size: 14px; }
  th, td { padding: 8px 6px; font-size: 12px; }
  .toolbar { gap: 8px; }
  .toolbar input, .toolbar select { min-width: 0 !important; width: 100%; }
  .modal { width: calc(100vw - 28px) !important; max-width: 460px; }
  .qr-img { width: 190px; height: 190px; }
  .sign-hint { flex-wrap: wrap; gap: 6px; font-size: 13px; }
  .sign-hint .sign-remain { margin-left: 0; }
  .kiosk-body { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar::-webkit-scrollbar, .nav::-webkit-scrollbar { display: none; }
  .sidebar, .nav { scrollbar-width: none; -ms-overflow-style: none; }
}

/* ---------- 手机端登录页：上下堆叠，收紧留白 ---------- */
@media (max-width: 860px) {
  .login-wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-hero { padding: 26px 20px 22px; }
  .login-hero h1 { font-size: 20px; line-height: 1.55; margin-bottom: 8px; letter-spacing: 0; }
  .login-hero h1 br { display: none; }
  .login-hero p { font-size: 12.5px; line-height: 1.7; max-width: none; }
  .login-hero ul { display: none; }
  .login-box { padding: 22px 18px 34px; align-items: flex-start; }
  .login-form { max-width: 100%; }
  .login-form h2 { font-size: 20px; }
  .login-form .sub { margin-bottom: 16px; }
  .login-tip { font-size: 11.5px; line-height: 1.75; }
}
