/* ============================================================
   国旗护卫队纪检部 · 请假审批与考勤评分管理系统
   浅色主题 / 数据密集型仪表盘 / 品牌红 #C8102E
   ============================================================ */
:root {
  --red: #C8102E;
  --red-dark: #A60D26;
  --red-tint: #FDF2F4;
  --red-tint-2: #FBE3E8;
  --gold: #FFD24D;
  --gold-deep: #C9A063;
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --line: #E7E9EE;
  --line-light: #F1F2F5;
  --ink: #1F232B;
  --muted: #6B7480;
  --muted2: #9AA1AB;
  --ok: #2E8B48;
  --ok-bg: #E7F6EC;
  --warn: #A96A12;
  --warn-bg: #FBF2E2;
  --bad: #C0392B;
  --bad-bg: #FCEBEB;
  --info: #35648F;
  --info-bg: #EAF1F8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12), 0 2px 8px rgba(16, 24, 40, .06);
  --ring: rgba(200, 16, 46, .14);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(200, 16, 46, .14); }

* { scrollbar-width: thin; scrollbar-color: #CBD1D9 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #CBD1D9; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #AEB6C0; background-clip: content-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

a { color: var(--red); text-decoration: none; }
.link { color: var(--red); font-size: 13px; cursor: pointer; }
.link:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: 13px; }

/* 键盘焦点可见（鼠标点击不显示） */
.btn:focus-visible, .btn-link:focus-visible, .link:focus-visible, .nav-item:focus-visible,
.auth-tab:focus-visible, .rc-btn:focus-visible, .rc-extra:focus-visible, .att-extra:focus-visible,
.extra-preset:focus-visible, .modal-x:focus-visible, .menu-toggle:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* ---------------- 布局 ---------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 16px;
  background: linear-gradient(150deg, var(--red) 0%, var(--red-dark) 100%);
  color: #fff;
}

.brand-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .22);
  color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 21px;
  flex-shrink: 0;
}

.brand-text b { display: block; font-size: 14.5px; line-height: 1.35; letter-spacing: .2px; }
.brand-text small { color: rgba(255, 255, 255, .72); font-size: 11.5px; }

.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px 9px 13px;
  margin: 2px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-size: 13.5px;
  user-select: none;
  position: relative;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: var(--line-light); color: var(--ink); }
.nav-item.active { background: var(--red-tint); color: var(--red); font-weight: 600; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -10px; top: 20%;
  width: 3px; height: 60%;
  border-radius: 0 3px 3px 0;
  background: var(--red);
}
.nav-group {
  padding: 14px 24px 6px;
  font-size: 11.5px;
  color: var(--muted2);
  letter-spacing: .08em;
  font-weight: 600;
}

.sidebar-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted2);
  font-size: 12px;
}

.sidebar-mask { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 56px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-title { font-size: 15px; font-weight: 600; letter-spacing: .2px; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }

.avatar {
  width: 31px; height: 31px;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--red), var(--red-dark));
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(200, 16, 46, .3);
}

.role-tag {
  font-size: 12px;
  color: var(--muted);
  background: var(--line-light);
  border-radius: 999px;
  padding: 2px 10px;
}
.role-tag.admin { color: var(--red); background: var(--red-tint); font-weight: 600; }

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  padding: 4px;
}
.menu-toggle svg { width: 22px; height: 22px; }

.content { padding: 20px; flex: 1; }

.view { display: none; }
.view.active { display: block; animation: fadeIn .18s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.card-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px 16px;
  flex-wrap: wrap;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}
.card-h h3 { font-size: 15px; font-weight: 600; letter-spacing: .2px; }
.card-b { padding: 16px 18px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ---------------- 统计卡 ---------------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat-row.compact { margin-bottom: 0; padding: 14px 18px 0; }

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  transition: box-shadow .15s ease, transform .15s ease;
}
.stat-card:hover { box-shadow: var(--shadow-lg); }
.stat-label { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.stat-value { font-size: 23px; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--muted2); font-size: 12px; margin-top: 4px; }

/* 统计卡强调色（左侧 3px 色条） */
.stat-card.tone-red { border-left: 3px solid var(--red); }
.stat-card.tone-ok { border-left: 3px solid var(--ok); }
.stat-card.tone-warn { border-left: 3px solid #E8A33D; }
.stat-card.tone-bad { border-left: 3px solid var(--bad); }
.stat-card.tone-info { border-left: 3px solid var(--info); }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left;
  padding: 10px 14px;
  background: #F7F8FA;
  color: #57606C;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-light);
  vertical-align: middle;
  transition: background .12s ease;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #F8F9FC; }
.table .num { font-variant-numeric: tabular-nums; }
.table .ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { padding: 44px 16px; text-align: center; color: var(--muted2); font-size: 13px; }
.empty::before {
  content: "★";
  display: block;
  font-size: 30px;
  color: #D6DAE1;
  margin-bottom: 8px;
  line-height: 1;
}

/* ---------------- 徽标 ---------------- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: .02em;
  line-height: 1.6;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.muted { background: #EFF0F3; color: var(--muted); }
.badge.info { background: var(--info-bg); color: var(--info); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
  font-family: inherit;
}
.btn:hover { border-color: #D4D8E0; background: #FAFBFC; }
.btn:active { background: #F4F5F7; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--red); border-color: var(--red); color: #fff; font-weight: 600;
  box-shadow: 0 1px 2px rgba(200, 16, 46, .22);
}
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); box-shadow: 0 2px 6px rgba(200, 16, 46, .26); }
.btn-primary:active { background: #8F0B20; }

.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #A93226; border-color: #A93226; }

.btn-danger-ghost { color: var(--bad); border-color: #F0C9C4; background: #FFF7F6; }
.btn-danger-ghost:hover { background: var(--bad-bg); border-color: #E5A9A2; }

.btn-primary-ghost { color: var(--ink); border-color: #CFE3F2; background: #F4F9FC; }
.btn-primary-ghost:hover { background: var(--info-bg); border-color: #9FCAE0; color: #fff; }

.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--line-light); color: var(--ink); }

.btn-sm { padding: 5px 12px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; color: var(--red); cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: 6px; font-family: inherit; font-weight: 500; }
.btn-link:hover { background: var(--red-tint); text-decoration: none; }
.btn-link.danger { color: var(--bad); }
.btn-link.danger:hover { background: var(--bad-bg); }

/* ---------------- 表单 ---------------- */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: var(--ink); margin-bottom: 6px; font-weight: 500; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.input, .select, .textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.input:hover, .select:hover, .textarea:hover { border-color: #D4D8E0; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--ring);
}
.textarea { resize: vertical; min-height: 84px; }

.form-card { max-width: 520px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.form-err { color: var(--bad); font-size: 13px; min-height: 20px; margin-bottom: 6px; }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-bar .input, .filter-bar .select { width: auto; min-width: 118px; }
.filter-bar .input#faKeyword, .filter-bar .input#memKeyword { min-width: 150px; }

.week-label {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  background: #F7F8FA;
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

/* ---------------- 提示 ---------------- */
.notice {
  background: #F0F6FD;
  border: 1px solid #D8E5F5;
  border-bottom: none;
  border-left: 3px solid var(--info);
  color: #33567E;
  padding: 10px 18px;
  font-size: 12.8px;
  line-height: 1.75;
}
.notice b { color: #1F3E60; }

.rule-list { padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 2.0; }
.rule-list li { margin-bottom: 2px; }
.rule-list b { color: var(--ink); }

/* ---------------- 分页 ---------------- */
.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 22, .45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-mask.show { display: flex; animation: fadeIn .15s ease; }

.modal {
  background: #fff;
  border-radius: 14px;
  width: 520px;
  max-width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  animation: popIn .18s ease;
}
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }

.modal-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-h h3 { font-size: 15px; }
.modal-x {
  background: none; border: none; font-size: 20px; cursor: pointer;
  color: var(--muted); line-height: 1; padding: 2px 6px; border-radius: 6px;
}
.modal-x:hover { background: var(--line-light); color: var(--ink); }
.modal-b { padding: 18px; }
.modal-f {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.detail-list { display: grid; grid-template-columns: 84px 1fr; gap: 8px 12px; font-size: 13.5px; }
.detail-list dt { color: var(--muted); }
.detail-list dd { word-break: break-all; }

/* ---------------- Toast ---------------- */
.toast-wrap {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: #fff;
  border: 1px solid var(--line);
  padding: 10px 18px 10px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  animation: toastIn .2s ease;
  max-width: 80vw;
  display: flex;
  align-items: center;
  gap: 9px;
}
.toast::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--info);
  flex-shrink: 0;
}
.toast.ok::before { background: var(--ok); }
.toast.bad::before { background: var(--bad); }
.toast.leaving { opacity: 0; transition: opacity .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------------- 图表 ---------------- */
.chart { min-height: 240px; }
.chart svg { display: block; }

.bar-row { display: flex; align-items: center; gap: 10px; margin: 11px 0; font-size: 13px; }
.bar-row .bar-label { width: 40px; color: var(--muted); flex-shrink: 0; }
.bar-track { flex: 1; background: #F1F2F5; border-radius: 6px; height: 16px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; min-width: 2px; transition: width .4s ease; }
.bar-val { width: 30px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------- 登录页 ---------------- */
.login-wrap {
  display: flex;
  min-height: 100vh;
  max-width: 1080px;
  margin: 0 auto;
  align-items: stretch;
}

.login-brand {
  flex: 1.15;
  background:
    radial-gradient(120% 90% at 85% 110%, rgba(255, 210, 77, .14) 0%, transparent 55%),
    linear-gradient(160deg, #C8102E 0%, #9E0C22 62%, #7E091B 100%);
  color: #fff;
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.login-brand::after {
  content: "★";
  position: absolute;
  right: -30px;
  bottom: -60px;
  font-size: 240px;
  color: rgba(255, 210, 77, .10);
  line-height: 1;
}
.brand-star { font-size: 52px; color: var(--gold); line-height: 1; margin-bottom: 26px; text-shadow: 0 4px 18px rgba(0,0,0,.25); }
.login-brand h1 { font-size: 30px; letter-spacing: 1px; margin-bottom: 8px; }
.brand-sub { font-size: 15px; opacity: .88; margin-bottom: 40px; letter-spacing: .5px; }
.brand-points { list-style: none; }
.brand-points li {
  padding: 9px 0 9px 26px;
  position: relative;
  font-size: 14px;
  opacity: .95;
}
.brand-points li::before {
  content: "★";
  position: absolute;
  left: 0;
  color: var(--gold);
  font-size: 12px;
  top: 12px;
}
.brand-foot { margin-top: auto; font-size: 12px; opacity: .65; letter-spacing: .5px; }

.login-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 28px; }

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 34px 32px 26px;
}
.login-card h2 { font-size: 20px; margin-bottom: 14px; }
.login-card .form-row:last-of-type { margin-bottom: 8px; }

.login-tip {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.9;
}
.login-tip b { color: var(--red); }
.login-install { margin-top: 12px; text-align: center; }
.login-install .link { font-size: 13px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 920px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, .12);
  }
  .sidebar.open { transform: none; }
  .sidebar-mask.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 18, 22, .35);
    z-index: 35;
  }
  .menu-toggle { display: inline-flex; }
  .content { padding: 14px; }
  .login-wrap { flex-direction: column; }
  .login-brand { padding: 40px 28px; }
  .brand-points { margin-bottom: 24px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .user-chip span:last-child { display: none; }
}

@media (max-width: 480px) {
  .stat-row { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .stat-value { font-size: 20px; }
  .card-h { padding: 12px 14px; }
  .card-b { padding: 14px; }
  .table th, .table td { padding: 9px 10px; }
  .table { font-size: 12.8px; }
  .content { padding: 10px; }
}

/* ============================================================
   云端版新增：根视图切换 / 认证页 / 居中提示页
   ============================================================ */
.view-root { display: none; }
.view-root.active { display: block; }

/* 登录注册页签 */
.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: #F1F2F5;
  padding: 4px;
  border-radius: 10px;
}
.auth-tab {
  flex: 1;
  padding: 7px 4px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.auth-tab:hover { color: var(--ink); }
.auth-tab.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }

.auth-pane { display: none; }
.auth-pane.active { display: block; animation: fadeIn .18s ease; }

/* 验证码行 */
.otp-row { display: flex; gap: 8px; }
.otp-row .input { flex: 1; min-width: 0; }
.otp-row .btn { flex-shrink: 0; }

/* 完善资料 / 待审核 / 已停用 居中页 */
.center-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.center-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 36px 32px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}
.center-card .icon { font-size: 40px; line-height: 1; margin-bottom: 12px; }
.center-card h2 { font-size: 19px; margin-bottom: 8px; }
.center-card > p { color: var(--muted); font-size: 13.5px; line-height: 1.9; margin-bottom: 20px; }
.center-card > p b { color: var(--ink); }
.center-card .form-actions { justify-content: center; margin-top: 4px; }

/* 考勤状态下拉（行内编辑） */
.att-status { min-width: 96px; padding: 5px 8px; font-size: 12.5px; }

/* ---------------- 学年考勤分（60/40/20 预警色） ---------------- */
.score-ok { color: var(--ok); font-weight: 600; }
.score-neg { color: var(--red); font-weight: 700; }
.score-warn { color: #D8930F; font-weight: 600; }   /* <60 预警 */
.score-bad { color: #D65A2A; font-weight: 700; }    /* <40 警告 */
.score-crit { color: var(--red); font-weight: 700; }/* <20 严重警告 */
.score-pos { color: var(--ok); font-weight: 700; }
.stat-value .score-neg, .stat-value .score-pos,
.stat-value .score-warn, .stat-value .score-bad, .stat-value .score-crit { font-size: 1.15em; }

/* ---------------- 双轨评分规则编辑 ---------------- */
.ded-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 4px 0 8px; }
.ded-track { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #FBFCFD; }
.ded-track-h { font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--ink); }
.ded-group { margin-bottom: 10px; }
.ded-group:last-child { margin-bottom: 0; }
.ded-group-h { font-size: 12.5px; color: var(--muted); margin: 4px 0 6px; border-left: 3px solid var(--red); padding-left: 8px; }
.ded-track .form-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.ded-track .form-row label { font-size: 13px; color: var(--ink); margin: 0; flex: 1; }
.ded-track .form-row .input { width: 76px; flex: 0 0 76px; text-align: center; }
@media (max-width: 720px) { .ded-grid { grid-template-columns: 1fr; } }

/* ---------------- 每日点名 ---------------- */
.rc-status { display: flex; gap: 4px; flex-wrap: wrap; }
.rc-btn {
  padding: 4px 9px; font-size: 12px; line-height: 1.4;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 6px; cursor: pointer; font-family: inherit;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.rc-btn:hover { border-color: var(--muted2); color: var(--ink); }
.rc-btn.on { border-color: transparent; font-weight: 600; box-shadow: inset 0 0 0 1px currentColor; }
.rc-btn.on.present { background: var(--ok-bg); color: var(--ok); }
.rc-btn.on.leave { background: var(--info-bg); color: var(--info); }
.rc-btn.on.absent { background: var(--bad-bg); color: var(--bad); }
.rc-btn.on.late,
.rc-btn.on.early { background: var(--warn-bg); color: var(--warn); }
.rc-btn.on.business { background: #EFF0F3; color: var(--muted); }
.rc-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 18px; border-top: 1px solid var(--line-light);
}
.rc-foot .muted { font-size: 12px; }
.rc-min { width: 76px; }
.rc-reason { width: 148px; }
.att-reason { width: 132px; }
@media (max-width: 720px) {
  .rc-status { gap: 3px; }
  .rc-btn { padding: 5px 8px; font-size: 11.5px; }
  .rc-reason { width: 118px; }
  .att-reason { width: 108px; }
}

/* ---------------- PWA：离线横幅 / 安装按钮 / 同步提示 ----------------
   底部固定元素统一叠加 env(safe-area-inset-bottom)，避免 iPhone Home 指示条区域
   （standalone 下约 34px）遮挡横幅与安装按钮（v1.0.24） */
.jjb-offline-bar {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 24px);
  z-index: 9998; display: flex; align-items: center; gap: 8px;
  max-width: calc(100vw - 32px); padding: 9px 16px;
  background: #2b2f36; color: #fff; font-size: 13px; line-height: 1.4;
  border-radius: 999px; box-shadow: 0 8px 24px rgba(0,0,0,.22);
  opacity: 0; pointer-events: none; transition: opacity .28s ease, transform .28s ease;
}
.jjb-offline-bar.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.jjb-offline-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #f0b429;
  box-shadow: 0 0 0 0 rgba(240,180,41,.6); animation: jjb-pulse 1.6s infinite;
  flex: 0 0 auto;
}
.jjb-offline-count { color: #ffd66b; font-variant-numeric: tabular-nums; white-space: nowrap; }
@keyframes jjb-pulse {
  0% { box-shadow: 0 0 0 0 rgba(240,180,41,.55); }
  70% { box-shadow: 0 0 0 7px rgba(240,180,41,0); }
  100% { box-shadow: 0 0 0 0 rgba(240,180,41,0); }
}

.jjb-install-btn {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 9997;
  padding: 10px 18px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--red); color: #fff; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 6px 18px rgba(200,16,46,.32);
  transition: transform .15s ease, box-shadow .15s ease;
}
.jjb-install-btn:hover { transform: translateY(-1px); box-shadow: 0 9px 22px rgba(200,16,46,.4); }
.jjb-install-btn:active { transform: translateY(0); }
/* 离线横幅显示时（body.jjb-offline-on，由 pwa.js 维护）：安装按钮上移避让，防止位置重叠 */
body.jjb-offline-on .jjb-install-btn { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }

.jjb-pwa-toast {
  position: fixed; left: 50%; top: 18px; transform: translate(-50%, -16px);
  z-index: 9999; padding: 10px 18px; border-radius: 10px; font-size: 13.5px;
  color: #fff; background: #2b2f36; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  opacity: 0; transition: opacity .3s ease, transform .3s ease; pointer-events: none;
}
.jjb-pwa-toast.show { opacity: 1; transform: translate(-50%, 0); }
.jjb-pwa-toast-ok { background: #1f8a4c; }

@media (max-width: 480px) {
  .jjb-offline-bar { font-size: 12.5px; padding: 8px 13px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .jjb-install-btn { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); padding: 9px 15px; font-size: 13px; }
  body.jjb-offline-on .jjb-install-btn { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------------- 其他事项扣分（点名页 / 考勤管理页 / 弹窗预设） ---------------- */
.rc-extra, .att-extra {
  border: 1px dashed #C9CFD9; background: #fff; color: var(--muted);
  border-radius: 6px; padding: 3px 9px; font-size: 12px; cursor: pointer;
  white-space: nowrap; transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.rc-extra:hover, .att-extra:hover { border-color: var(--red); color: var(--red); }
.rc-extra.has, .att-extra.has {
  border: 1px solid var(--red); color: var(--red); background: var(--red-tint); font-weight: 600;
}
.extra-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.extra-preset { font-size: 12.5px; }
.extra-preset b { color: var(--red); }

/* ---------------- 本场扣分覆盖（v1.0.37 自定义扣分） ----------------
   点名页每行「本场扣分」可手填覆盖系统自动值；覆盖仅替换状态基础分，
   其他事项扣分继续叠加；出勤不计状态分、覆盖值无效。
   输入框值代表「本场扣分合计」，清空或点 ↺ 恢复自动；手填后高亮蓝色。 */
.rc-ovr-lbl { display: none; }
.rc-dedwrap { display: inline-flex; align-items: center; gap: 4px; }
.rc-ovr {
  width: 62px; padding: 3px 6px; font-size: 13px; text-align: right;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink);
}
.rc-ovr:focus { outline: none; border-color: var(--blue, #1d4ed8); }
.rc-ovr.manual { color: #1d4ed8; border-color: #1d4ed8; font-weight: 600; background: #eef4ff; }
.rc-reset {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 6px; padding: 3px 7px; font-size: 13px; cursor: pointer; line-height: 1;
}
.rc-reset:hover { border-color: var(--blue, #1d4ed8); color: #1d4ed8; }
.rc-reset.manual { border-color: #1d4ed8; color: #1d4ed8; background: #eef4ff; }

/* ---------------- 动效减弱（系统偏好） ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------------- 打印（周公示表发群 / 留档） ---------------- */
@media print {
  .sidebar, .sidebar-mask, .topbar, .filter-bar, .pagination, .rc-foot,
  .jjb-offline-bar, .jjb-install-btn, .toast-wrap, .notice { display: none !important; }
  body { background: #fff; }
  .layout, .main { display: block; }
  .content { padding: 0; }
  .card { border: none; box-shadow: none; margin: 0 0 8px; }
  .view { display: none !important; }
  .view.active { display: block !important; }
  .table th { background: #fff !important; border-bottom: 2px solid #333 !important; }
  .stat-row.compact { padding: 0 0 8px; }
}

/* ---------------- 请假场次勾选（提交假条弹窗） ---------------- */
.session-checkboxes {
  display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 6px;
  border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; background: #fafafa;
}
.session-item {
  display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink);
  cursor: pointer; white-space: nowrap;
}
.session-item input { width: 16px; height: 16px; flex: 0 0 16px; cursor: pointer; }
.session-item span { cursor: pointer; }
.session-item:hover { color: var(--red); }

/* ============================================================
   手机端 · 每日点名卡片化（v1.0.30）
   ------------------------------------------------------------
   问题：点名表 6 列 auto 布局在 375px 下总宽 535px > 可用 353px，
        「状态」列被压缩到 61px，.rc-status 的 flex-wrap 被迫把
        6 个状态按钮竖排成 6 行 → 单人一行约 202px，
        一屏只能看 3 人；加上顶部（工具栏/说明/统计卡）约 810px，
        首屏甚至看不到第一位成员。
   做法：不改任何 DOM 与类名，仅用媒体查询把 table 重排为卡片。
        姓名与扣分同行 → 6 个按钮一行等分 → 需要时再出输入行。
   ============================================================ */
@media (max-width: 720px) {
  /* 保存按钮改为 fixed，需要取消祖先的 transform 动画（fadeIn 含 translateY） */
  #view-rollcall.active { animation: none; }

  /* ---------- 1) 顶部减法 ---------- */
  #view-rollcall .card-h { padding: 10px 12px; gap: 8px; }
  #view-rollcall .card-h h3 { display: none; }          /* 顶栏已有「每日点名」 */
  #view-rollcall .filter-bar {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    width: 100%;
  }
  #rcPrev { grid-column: span 2; }
  #rcLabel { grid-column: span 2; text-align: center; font-size: 12.5px; padding: 5px 4px; white-space: nowrap; }
  #rcNext { grid-column: span 2; }
  #rcCampus, #rcGrade, #rcKind {
    grid-column: span 2; min-width: 0; width: 100%;
    font-size: 12.5px; padding: 6px 4px;
  }
  #rcNow { grid-column: 1 / -1; }

  /* 说明条：只缩字号行高，不截断（关键提示不能丢） */
  #view-rollcall .notice { font-size: 11.5px; line-height: 1.5; padding: 8px 12px; }

  /* 统计卡：6 张改横向滑动的一行 chips，省掉约 280px */
  #rcSummary {
    display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden;
    padding: 10px 12px 0; margin: 0;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  #rcSummary::-webkit-scrollbar { display: none; }
  #rcSummary .stat-card {
    flex: 0 0 auto; min-width: 90px;
    padding: 8px 10px; box-shadow: none; border-radius: 8px;
  }
  #rcSummary .stat-label { font-size: 11px; margin-bottom: 2px; white-space: nowrap; }
  #rcSummary .stat-value { font-size: 18px; line-height: 1.2; }
  #rcSummary .stat-sub { display: none; }

  /* ---------- 2) 表格 → 卡片 ---------- */
  #rcTable,
  #rcTable .table-wrap { overflow: visible; }           /* 解开双层横向滚动 */
  #rcTable .table { display: block; width: 100%; font-size: 13px; }
  #rcTable thead { display: none; }
  #rcTable tbody { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; }
  #rcTable tr {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
  }
  #rcTable tbody tr:hover td { background: transparent; }
  #rcTable td { display: none; padding: 0; border: 0; }

  /* 第 1 行：姓名 | 另扣 | 本场扣分 */
  #rcTable td:nth-child(1) {
    display: block; grid-column: 1 / span 6; grid-row: 1;
    align-self: center; font-weight: 600; font-size: 14px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  #rcTable td:nth-child(1) .badge { font-size: 10.5px; padding: 1px 7px; margin-left: 4px; vertical-align: 1px; }
  #rcTable td:nth-child(5) {
    display: block; grid-column: 7 / span 3; grid-row: 1;
    align-self: center; justify-self: end;
  }
  #rcTable td:nth-child(6) {
    display: block; grid-column: 10 / span 3; grid-row: 1;
    align-self: center; justify-self: end; text-align: right;
  }

  /* 第 2 行：6 个状态按钮一行等分（这是本次优化的核心） */
  #rcTable td:nth-child(2) { display: block; grid-column: 1 / -1; grid-row: 2; }
  #rcTable .rc-status {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    flex-wrap: nowrap;
  }
  #rcTable .rc-btn {
    padding: 7px 0;
    font-size: 12px;
    line-height: 1.2;
    min-width: 0;
    text-align: center;
  }

  /* 第 3 行：迟到分钟 + 理由（仅非出勤时出现） */
  #rcTable td:nth-child(3) { display: block; grid-column: 1 / span 3; grid-row: 3; }
  #rcTable td:nth-child(4) { display: block; grid-column: 4 / span 9; grid-row: 3; }
  /* 出勤行的这两格只有「—」占位，隐藏掉可再省一行；
     不支持 :has() 的旧机保留占位，功能不受影响 */
  @supports selector(:has(*)) {
    #rcTable td:nth-child(3):not(:has(input)),
    #rcTable td:nth-child(4):not(:has(input)) { display: none; }
  }

  /* 卡片内的输入控件撑满所在格（模板里 .rc-min 有 inline width:76px） */
  #rcTable .rc-min { width: 100% !important; padding: 6px 8px; font-size: 13px; }
  #rcTable .rc-reason { width: 100%; padding: 6px 8px; font-size: 13px; }
  #rcTable .rc-extra {
    padding: 5px 9px; font-size: 11.5px; white-space: nowrap;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  }
  #rcTable .rc-ded { font-size: 13.5px; font-weight: 600; }
  /* 本场扣分覆盖控件：右上角紧凑化，宽度含步进箭头内嵌，不撑破卡片 */
  #rcTable .rc-dedwrap { gap: 3px; justify-content: flex-end; }
  #rcTable .rc-ovr { width: 48px; padding: 3px 4px; font-size: 12px; }
  #rcTable .rc-reset { padding: 3px 5px; font-size: 12px; }

  /* ---------- 3) 底部：批量按钮 + 保存吸底 ---------- */
  #view-rollcall { padding-bottom: 74px; }
  #view-rollcall .rc-foot { padding: 10px 12px; gap: 8px; border-top: none; }
  #view-rollcall .rc-foot .muted { font-size: 11.5px; }
  #rcSave {
    position: fixed; left: 0; right: 0; bottom: 0; width: 100%;
    margin: 0; border-radius: 0;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    font-size: 15px; z-index: 40;
    box-shadow: 0 -4px 14px rgba(15, 23, 42, .12);
  }
}
