/* ===== 教师上课打卡定位统计系统 - 公共样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #2f6bff;
  --primary-dark: #1f4fd8;
  --success: #10b981;
  --danger: #ef4444;
  --warn: #f59e0b;
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --text2: #6b7280;
  --line: #e5e9f2;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(31, 60, 120, .07);
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }

/* ===== H5 移动端容器 ===== */
.phone {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: 70px;
}

/* 顶部栏 */
.navbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(135deg, #2f6bff, #5b8cff);
  color: #fff;
  padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between;
  border-radius: 0 0 18px 18px;
}
.navbar .title { font-size: 17px; font-weight: 600; }
.navbar .sub { font-size: 12px; opacity: .85; margin-top: 2px; }
.navbar .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.navbar .avatar.click { cursor: pointer; }

/* 底部导航 */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 60;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; text-align: center; padding: 8px 0 7px;
  color: var(--text2); font-size: 11px;
}
.tabbar a .ico { font-size: 20px; display: block; line-height: 1.2; }
.tabbar a.active { color: var(--primary); font-weight: 600; }

/* 卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 14px;
}
.card h3 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.card h3 .tag { font-size: 11px; font-weight: 400; color: var(--text2); }
.section-title { font-size: 14px; font-weight: 600; margin: 18px 18px 8px; color: var(--text2); }

/* 网格入口 */
.grid-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px; }
.menu-item {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 14px; text-align: center; color: var(--text);
  transition: transform .15s;
}
.menu-item:active { transform: scale(.97); }
.menu-item .ico {
  width: 44px; height: 44px; border-radius: 12px; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff;
}
.menu-item .name { font-size: 14px; font-weight: 600; }
.menu-item .desc { font-size: 11px; color: var(--text2); margin-top: 3px; }

/* 按钮 */
.btn {
  display: block; width: 100%;
  border: none; border-radius: 12px;
  padding: 13px; font-size: 15px; font-weight: 600;
  cursor: pointer; text-align: center; transition: opacity .15s;
}
.btn:active { opacity: .85; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 14px; width: auto; font-size: 13px; display: inline-block; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--line);
  border-radius: 10px; font-size: 15px; background: #fafbfd; color: var(--text);
  outline: none; font-family: inherit;
}
.field input:focus, .field select:focus { border-color: var(--primary); background: #fff; }

/* 徽标 */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.b-ok { background: #e6f8f1; color: #0b8f6a; }
.b-late { background: #fef3e2; color: #c2790a; }
.b-out { background: #fdeaea; color: #cf4436; }
.b-info { background: #e8efff; color: #2f6bff; }
.b-gray { background: #eef1f6; color: #6b7280; }

/* 列表 */
.record-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px dashed var(--line);
}
.record-item:last-child { border-bottom: none; }
.record-item .l1 { font-size: 14px; font-weight: 600; }
.record-item .l2 { font-size: 12px; color: var(--text2); margin-top: 3px; }

/* 统计数字块 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px; }
.stat-box {
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
  padding: 12px 6px; text-align: center;
}
.stat-box .num { font-size: 20px; font-weight: 700; }
.stat-box .lbl { font-size: 11px; color: var(--text2); margin-top: 3px; }

/* 标签页 */
.tabs { display: flex; gap: 8px; margin: 14px; }
.tabs .tab {
  flex: 1; text-align: center; padding: 9px 0; border-radius: 10px;
  background: #fff; color: var(--text2); font-size: 14px; cursor: pointer;
  border: 1.5px solid transparent; box-shadow: var(--shadow);
}
.tabs .tab.active { color: var(--primary); border-color: var(--primary); font-weight: 600; }

/* 条形图 */
.bar-row { display: flex; align-items: center; gap: 8px; margin: 9px 0; font-size: 12px; }
.bar-row .bl { width: 64px; color: var(--text2); text-align: right; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .bar-track { flex: 1; height: 14px; background: #e9eef7; border-radius: 8px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; border-radius: 8px; background: var(--primary); transition: width .4s; }
.bar-row .bar-fill.late { background: var(--warn); }
.bar-row .bv { width: 34px; font-weight: 600; flex-shrink: 0; }

/* 打卡大按钮 */
.punch-wrap { text-align: center; padding: 22px 0 6px; }
.punch-btn {
  width: 160px; height: 160px; border-radius: 50%;
  border: 6px solid #dbe7ff;
  background: radial-gradient(circle at 35% 30%, #4d86ff, #1f4fd8);
  color: #fff; font-size: 20px; font-weight: 700;
  box-shadow: 0 8px 26px rgba(47,107,255,.4);
  cursor: pointer; margin: 0 auto; display: block;
}
.punch-btn:active { transform: scale(.96); }
.punch-btn:disabled { background: #c4c9d4; box-shadow: none; border-color: #e2e5eb; }
.clock { font-size: 34px; font-weight: 700; letter-spacing: 1px; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.date-str { color: var(--text2); font-size: 13px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,25,45,.45);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px; padding: 20px;
  width: 100%; max-width: 420px; max-height: 82vh; overflow-y: auto;
}
.modal h3 { font-size: 16px; margin-bottom: 14px; }

/* toast */
#toast {
  position: fixed; left: 50%; top: 20%; transform: translateX(-50%) translateY(-8px);
  background: rgba(20,30,50,.88); color: #fff; font-size: 14px;
  padding: 10px 18px; border-radius: 10px; z-index: 200;
  opacity: 0; pointer-events: none; transition: all .25s; max-width: 80%; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 登录注册页 */
.auth-page {
  max-width: 480px; margin: 0 auto; min-height: 100vh;
  background: linear-gradient(160deg, #2f6bff 0%, #6ea0ff 60%, #f3f6fb 100%);
  padding: 60px 26px 30px;
}
.auth-card {
  background: #fff; border-radius: 20px; padding: 28px 22px;
  box-shadow: 0 12px 40px rgba(20,50,120,.18);
}
.auth-logo { text-align: center; color: #fff; margin-bottom: 28px; }
.auth-logo .ico { font-size: 44px; }
.auth-logo h1 { font-size: 21px; margin-top: 8px; }
.auth-logo p { font-size: 12px; opacity: .85; margin-top: 4px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 16px; font-size: 13px; }

/* ===== 后台管理（宽屏） ===== */
.admin-body { background: #f0f3f9; }
.admin-layout { display: flex; min-height: 100vh; }
.admin-side {
  width: 210px; background: #172554; color: #cbd5e1; flex-shrink: 0;
  padding: 18px 0; min-height: 100vh; position: sticky; top: 0;
}
.admin-side .brand { color: #fff; font-size: 16px; font-weight: 700; padding: 4px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.admin-side .brand span { font-size: 11px; display: block; color: #93a4c8; font-weight: 400; margin-top: 3px; }
.admin-menu { margin-top: 10px; }
.admin-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; color: #b9c6dd; font-size: 14px;
}
.admin-menu a:hover { background: rgba(255,255,255,.06); color: #fff; }
.admin-menu a.active { background: var(--primary); color: #fff; }
.admin-main { flex: 1; padding: 22px 26px; max-width: 1100px; }
.admin-main h2 { font-size: 20px; margin-bottom: 4px; }
.admin-main .crumb { font-size: 12px; color: var(--text2); margin-bottom: 18px; }

.a-card { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.a-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.a-stat { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 16px; }
.a-stat .lbl { font-size: 12px; color: var(--text2); }
.a-stat .num { font-size: 26px; font-weight: 700; margin-top: 5px; }
.a-stat .num.blue { color: var(--primary); }
.a-stat .num.green { color: var(--success); }
.a-stat .num.orange { color: var(--warn); }
.a-stat .num.red { color: var(--danger); }

table.atable { width: 100%; border-collapse: collapse; font-size: 13px; }
table.atable th, table.atable td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); }
table.atable th { color: var(--text2); font-weight: 600; background: #f8fafd; }
table.atable tr:hover td { background: #f7faff; }
.table-wrap { overflow-x: auto; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar select, .toolbar input {
  padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 9px; font-size: 13px; background: #fff;
}
.sch-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.sch-row input { padding: 8px; border: 1.5px solid var(--line); border-radius: 9px; font-size: 13px; }
.sch-row .si1 { flex: 2.2; }
.sch-row .si2, .sch-row .si3 { flex: 1; }
.sch-row .del { color: var(--danger); cursor: pointer; border: none; background: none; font-size: 16px; }

@media (max-width: 720px) {
  .admin-layout { flex-direction: column; }
  .admin-side { width: 100%; position: static; }
  .admin-menu { display: flex; overflow-x: auto; }
  .admin-menu a { white-space: nowrap; }
  .a-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-main { padding: 16px 12px; }
}

.empty { text-align: center; color: var(--text2); font-size: 13px; padding: 26px 0; }
.mt8 { margin-top: 8px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
