/* ============================================================
 * 考勤展示系统 · 样式（浅色主题）
 * ============================================================ */
:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --line: #e5e8ee;
  --line-2: #eef1f5;
  --text: #1f2430;
  --text-2: #5b6472;
  --text-3: #9aa3b2;
  --brand: #2563eb;
  --brand-soft: #eef4ff;
  --ok: #16a34a;
  --ok-soft: #eafaf0;
  --warn: #d97706;
  --warn-soft: #fff7e8;
  --bad: #dc2626;
  --bad-soft: #fdeeee;
  --duty: #7c3aed;
  --duty-soft: #f3eefe;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .05);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.hide { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 32px 28px; }
.login-card h1 { margin: 0 0 4px; font-size: 21px; letter-spacing: .3px; }
.login-card .sub { color: var(--text-3); font-size: 13px; margin-bottom: 22px; }
.brand-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.brand-dot { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #2563eb, #4f8ef7); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=date], input[type=number], input[type=tel], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; outline: none; transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
textarea { resize: vertical; min-height: 90px; font-size: 13px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border: 1px solid var(--line); background: #fff; border-radius: 9px; cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:hover { background: var(--panel-2); border-color: #d5dae3; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #1d4fd8; }
.btn.danger { color: var(--bad); border-color: #f3c7c7; background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--brand-soft); color: var(--brand); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.err { background: var(--bad-soft); color: var(--bad); border: 1px solid #f6d3d3; padding: 9px 12px; border-radius: 9px; font-size: 13px; margin-bottom: 14px; }
.hint { font-size: 12.5px; color: var(--text-3); }
.quick { margin-top: 22px; border-top: 1px dashed var(--line); padding-top: 14px; }
.quick-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.quick-list { max-height: 220px; overflow: auto; border: 1px solid var(--line-2); border-radius: 9px; }
.quick-item { display: flex; justify-content: space-between; align-items: center; padding: 7px 11px; cursor: pointer; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.quick-item:last-child { border-bottom: 0; }
.quick-item:hover { background: var(--brand-soft); }
.quick-item .role { font-size: 11px; padding: 1px 6px; border-radius: 20px; background: var(--brand-soft); color: var(--brand); }
.quick-item .role.admin { background: var(--duty-soft); color: var(--duty); }
.quick-item .role.dataadmin { background: var(--warn-soft); color: var(--warn); }
.quick-item .ph { font-family: var(--mono); font-size: 12px; color: var(--text-3); }

/* ---------- 布局 ---------- */
.topbar { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { max-width: 1280px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 14px; }
.topbar .logo { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.who { text-align: right; line-height: 1.25; font-size: 13px; }
.who small { display: block; color: var(--text-3); font-size: 11.5px; }
.role-tag { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--brand-soft); color: var(--brand); }
.role-tag.admin { background: var(--duty-soft); color: var(--duty); }
.role-tag.dataadmin { background: var(--warn-soft); color: var(--warn); }

.tabs { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 56px; z-index: 19; }
.tabs-in { max-width: 1280px; margin: 0 auto; padding: 0 20px; display: flex; gap: 4px; overflow-x: auto; }
.tab { padding: 12px 14px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; font-size: 13.5px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
main { max-width: 1280px; margin: 0 auto; padding: 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.card > h2 { margin: 0; padding: 14px 18px; font-size: 15px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card > h2 .spacer { flex: 1; }
.card .body { padding: 18px; }
.card .body.tight { padding: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { margin-bottom: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.g5 { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }

/* ---------- 指标卡 ---------- */
.stat { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 13px 15px; }
.stat .k { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 5px; }
.stat .v { font-size: 25px; font-weight: 650; letter-spacing: -.5px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: 3px; }
.stat.is-ok .v { color: var(--ok); }
.stat.is-warn .v { color: var(--warn); }
.stat.is-bad .v { color: var(--bad); }
.stat.is-duty .v { color: var(--duty); }
.stat .sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.duty { background: var(--duty-soft); color: var(--duty); }
.badge.gray { background: var(--line-2); color: var(--text-2); }

/* ---------- 表 ---------- */
.table-wrap { overflow: auto; max-height: 70vh; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 11px; border-bottom: 1px solid var(--line-2); text-align: left; white-space: nowrap; }
th { background: var(--panel-2); position: sticky; top: 0; z-index: 2; font-weight: 600; color: var(--text-2); font-size: 12.5px; }
tbody tr:hover { background: #f8fafc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* ---------- 值日列视觉区分（值日与日常分属两个考核维度，用紫色区分开） ---------- */
th.duty-col { color: var(--duty); background: var(--duty-soft); }
td.duty-col { background: #faf8ff; color: var(--duty); font-weight: 600; }
td.duty-col.duty-warn { background: #fdeef0; color: var(--bad); }
tr:hover td.duty-col { background: #f6f2ff; }
tr:hover td.duty-col.duty-warn { background: #fce7ea; }
/* 值日专块的表头也沿用紫色，让「这块是值日」一眼可辨 */
.duty-block th { color: var(--duty); background: var(--duty-soft); }
td.mono { font-family: var(--mono); font-size: 12px; }
tr.dup-name td:nth-child(1)::after { content: " 同名"; font-size: 10.5px; color: var(--warn); background: var(--warn-soft); padding: 0 5px; border-radius: 8px; margin-left: 5px; }
td .cell-edit { width: 100%; padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 12.5px; }
td.ov { background: var(--warn-soft); }
.day-cell { font-size: 12px; white-space: normal; min-width: 130px; max-width: 240px; line-height: 1.5; }
.day-cell.rest { color: var(--text-3); }
.day-cell.duty { color: var(--duty); font-weight: 600; }
.day-cell.bad { color: var(--bad); }
.day-cell.warn { color: var(--warn); }

/* ---------- 值日周历 ---------- */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--panel-2); min-height: 92px; }
.day.weekend { background: #f7f8fa; }
.day.on-duty { border-color: #c9b6f5; background: var(--duty-soft); }
.day .d { font-size: 12px; color: var(--text-3); display: flex; justify-content: space-between; }
.day .s { font-size: 12.5px; margin-top: 6px; word-break: break-all; line-height: 1.5; }
.day .s.ok { color: var(--ok); }
.day .s.bad { color: var(--bad); }
.day .s.warn { color: var(--warn); }
.day .s.duty { color: var(--duty); font-weight: 600; }
.day .s.mute { color: var(--text-3); }

/* ---------- 其它 ---------- */
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: #1f2430; color: #fff; padding: 10px 18px; border-radius: 9px; font-size: 13.5px; z-index: 100; box-shadow: 0 8px 28px rgba(0,0,0,.22); max-width: 80vw; }
.toast.bad { background: var(--bad); }
.modal-mask { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); display: grid; place-items: center; z-index: 90; padding: 20px; }
.modal { background: var(--panel); border-radius: 14px; width: 100%; max-width: 640px; max-height: 88vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h3 { margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--line-2); font-size: 15px; }
.modal .mbody { padding: 18px 20px; }
.modal .mfoot { padding: 14px 20px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 10px; }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 34px 20px; text-align: center; color: var(--text-3); cursor: pointer; transition: .15s; background: var(--panel-2); }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.kv { display: grid; grid-template-columns: 108px 1fr; gap: 7px 12px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; }
.code { font-family: var(--mono); font-size: 12px; background: var(--panel-2); border: 1px solid var(--line-2); padding: 9px 11px; border-radius: 8px; word-break: break-all; }
.empty { text-align: center; color: var(--text-3); padding: 44px 20px; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 4px; vertical-align: middle; }
.note-banner { background: var(--warn-soft); border: 1px solid #f6e0b8; color: #8a5a06; padding: 10px 13px; border-radius: 9px; font-size: 13px; margin-bottom: 14px; }
.note-banner.info { background: var(--brand-soft); border-color: #cfe0ff; color: #1e40af; }
@media (max-width: 640px) {
  .week-strip { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: 88px 1fr; }
  main { padding: 12px; }
}
