:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #e3e6ea;
  --text: #1f2328;
  --muted: #6a737d;
  --brand: #2f5597;
  --brand-soft: #eaf0fa;
  --ok: #1a7f37;
  --ok-soft: #e8f4ec;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --bad: #c62828;
  --bad-soft: #fdecec;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .brand { font-weight: 600; font-size: 15px; color: var(--text); }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
}
.topbar nav a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.topbar nav a.on { background: var(--brand); color: #fff; }
.topbar .who { color: var(--muted); font-size: 13px; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 24px; }

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 20px; font-weight: 600; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.panel h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.panel h2 .hint { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 8px; }

.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat .k { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.stat .v { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 3px; }
.stat.hl { border-color: #c5d5ee; background: var(--brand-soft); }
.stat.hl .v { color: var(--brand); }
.stat .last { font-size: 12px; color: var(--muted); margin-top: 6px; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=number], input[type=date], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 85, 151, .1);
}
.field { margin-bottom: 16px; }
.field .last { font-size: 12px; color: var(--muted); margin-top: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #f2f4f7; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #274a85; }
.btn.danger { color: var(--bad); border-color: #f0c9c9; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
th {
  background: #fafbfc;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #fafbfc; }
tr.total { font-weight: 600; background: #fafbfc; }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 18px;
}
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.mute { background: #f0f2f4; color: var(--muted); }
.tag.brand { background: var(--brand-soft); color: var(--brand); }

.flash {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 13px;
}
.flash.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid #bfe0ca; }
.flash.error { background: var(--bad-soft); color: var(--bad); border: 1px solid #f0c9c9; }

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

.scroll { max-height: 560px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }

.note {
  font-size: 12px;
  color: var(--muted);
  background: #fafbfc;
  border-left: 3px solid var(--line);
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
  margin-top: 12px;
}
.note.warn { background: var(--warn-soft); border-left-color: var(--warn); color: #7c4a08; }
.note.bad { background: var(--bad-soft); border-left-color: var(--bad); color: #8f1d1d; }

.irow { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.irow > * { flex: 0 0 auto; }
.irow .grow { flex: 1 1 200px; }

.modal-bg {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .35);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-bg.on { display: flex; }
.modal {
  background: #fff; border-radius: 12px; padding: 22px; width: 100%; max-width: 480px;
}
.modal h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.modal .ctx { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.modal .acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

@media (max-width: 720px) {
  .wrap { padding: 14px; }
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar .who { display: none; }
  th, td { padding: 7px 6px; }
}

/* ---------------- 登录页 ---------------- */
.login-wrap {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 34px 32px 26px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.login-card .logo {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-card .steps {
  text-align: left;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 2;
}
.login-card .steps b {
  display: inline-block;
  width: 17px;
  height: 17px;
  line-height: 17px;
  text-align: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  margin-right: 8px;
}
.login-card .foot {
  font-size: 12px;
  color: var(--muted);
  margin-top: 22px;
  line-height: 1.8;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.btn.block { display: flex; justify-content: center; width: 100%; padding: 11px; font-size: 14px; }

/* 应急登录折叠块 */
.bd {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  text-align: left;
}
.bd > summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  list-style: none;
  user-select: none;
}
.bd > summary::-webkit-details-marker { display: none; }
.bd > summary::before { content: "▸ "; }
.bd[open] > summary::before { content: "▾ "; }
.bd input {
  width: 100%;
  box-sizing: border-box;
  margin: 10px 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
.bd-hint { font-size: 11.5px; color: var(--muted); margin-top: 8px; line-height: 1.7; }

/* ---------------- 错误页 ---------------- */
.err-wrap {
  text-align: center;
  padding: 70px 20px;
}
.err-code {
  font-size: 52px;
  font-weight: 600;
  color: var(--line);
  line-height: 1;
  letter-spacing: 2px;
}
.err-msg { font-size: 17px; font-weight: 500; margin: 14px 0 10px; }
.err-hint {
  color: var(--muted);
  font-size: 13px;
  max-width: 480px;
  margin: 0 auto 24px;
  line-height: 1.9;
}

/* ---------------- 应出勤分层规则 ---------------- */
.sub-h {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  margin: 4px 0 12px;
  padding-left: 9px;
  border-left: 3px solid var(--brand);
}
.gp-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
  background: #fafbfc;
}
.mem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 4px 12px;
  max-height: 190px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  margin-top: 6px;
}
.mem {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text);
  margin: 0;
  padding: 2px 0;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mem input { width: auto; margin: 0; flex: 0 0 auto; }
.hit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
