* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f1f5f9; --card: #fff; --line: #e2e8f0; --ink: #1e293b; --muted: #64748b;
  --brand: #3b82f6; --brand-d: #2563eb; --ok: #16a34a; --bad: #dc2626; --warn: #d97706;
  --in: #16a34a; --out: #dc2626;
}
body { font: 14px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--ink); background: var(--bg); }
.hidden { display: none !important; }
button { cursor: pointer; font: inherit; border: 1px solid var(--brand); background: var(--brand); color: #fff; padding: 7px 16px; border-radius: 8px; transition: .15s; }
button:hover { background: var(--brand-d); }
button.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
button.ghost:hover { background: #f1f5f9; }
button.sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
button.danger { background: var(--bad); border-color: var(--bad); }
button.link { background: none; border: none; color: var(--brand); padding: 2px; }
input, select, textarea { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--brand); }
input[type="month"], input[type="date"] { min-width: 140px; }
.err { color: var(--bad); font-size: 13px; }

/* 登录 */
.login-wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a, #1e3a8a); }
.login-card { background: #fff; padding: 40px 36px; border-radius: 16px; width: 340px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.login-card h1 { font-size: 22px; text-align: center; margin-bottom: 8px; color: #1e3a8a; }
.login-card input { padding: 11px 14px; }
.login-card button { padding: 11px; font-weight: 600; font-size: 15px; }

/* 框架 */
#app { display: flex; min-height: 100vh; }
.sidebar { width: 210px; background: #0f172a; color: #cbd5e1; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; z-index: 10; }
.brand { font-size: 18px; font-weight: 700; color: #fff; padding: 22px 20px; border-bottom: 1px solid #1e293b; letter-spacing: .5px; }
#nav { flex: 1; padding: 8px 0; display: flex; flex-direction: column; }
.navitem { color: #94a3b8; text-decoration: none; padding: 12px 20px; font-size: 14px; border-left: 3px solid transparent; transition: .12s; }
.navitem:hover { background: #1e293b; color: #e2e8f0; }
.navitem.active { background: #1e293b; color: #fff; border-left-color: var(--brand); font-weight: 600; }
.user-box { padding: 16px 20px; border-top: 1px solid #1e293b; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.user-box .link { color: #60a5fa; text-align: left; }
main { margin-left: 210px; flex: 1; padding: 24px 28px; max-width: calc(100vw - 210px); }

/* 卡片 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.card h2 { font-size: 16px; margin-bottom: 16px; color: #334155; }
.card h3 { font-size: 14px; color: var(--muted); margin: 16px 0 8px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }
.pagehead { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.pagehead h1 { font-size: 22px; font-weight: 700; }

/* 统计标签(固定大小格子, 网格对齐, 少的尾部留空) */
.stats { display: grid; grid-template-columns: repeat(auto-fill, 150px); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 10px; text-align: center; width: 150px; height: 76px; display: flex; flex-direction: column; justify-content: center; box-shadow: 0 1px 2px rgba(0,0,0,.03); overflow: hidden; }
.stat.empty { background: transparent; border: 1px dashed var(--line); box-shadow: none; }
.stat .label { font-size: 12px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; }
.stat .val { font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.in .val { color: var(--in); }
.stat.out .val { color: var(--out); }

/* 表格 */
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
th { background: #f8fafc; font-weight: 600; position: sticky; top: 0; z-index: 1; font-size: 12px; color: var(--muted); }
tbody tr:hover { background: #f8fafc; }
.tablewrap { overflow: auto; max-height: 68vh; border: 1px solid var(--line); border-radius: 10px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tag-in { color: var(--in); font-weight: 600; }
.tag-out { color: var(--out); font-weight: 600; }

/* badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge.pool { background: #fef3c7; color: #92400e; }
.badge.assigned { background: #dbeafe; color: #1e40af; }
.badge.returned { background: #fee2e2; color: #991b1b; }
.badge.normal { background: #dcfce7; color: #166534; }
.badge.late, .badge.early { background: #fef3c7; color: #92400e; }
.badge.absent { background: #fee2e2; color: #991b1b; }

/* 弹窗 */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 50; backdrop-filter: blur(3px); }
.modal { background: #fff; border-radius: 14px; padding: 26px; width: 580px; max-width: 94vw; max-height: 88vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal h2 { margin-bottom: 18px; }
.formgrid { display: grid; grid-template-columns: 100px 1fr; gap: 10px 14px; align-items: center; }
.formgrid label { color: var(--muted); font-size: 13px; }
.formgrid input, .formgrid select, .formgrid textarea { width: 100%; }

/* toast */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px); background: #0f172a; color: #fff; padding: 12px 20px; border-radius: 10px; opacity: 0; transition: .3s; z-index: 99; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }

.tabs { display: flex; gap: 0; margin-bottom: 16px; }
.tab { padding: 8px 20px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #eef2ff; color: #3730a3; padding: 3px 10px; border-radius: 20px; font-size: 12px; }
.chip button { background: none; border: none; color: #3730a3; padding: 0; font-size: 14px; }

/* 通知铃铛 */
#notifWrap { position: fixed; top: 16px; right: 20px; z-index: 60; }
#notifBell { position: relative; background: #fff; color: #334155; border: 1px solid var(--line); border-radius: 50%; width: 44px; height: 44px; font-size: 18px; padding: 0; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
#notifBell:hover { background: #f1f5f9; }
.notif-badge { position: absolute; top: -4px; right: -4px; background: var(--bad); color: #fff; border-radius: 20px; min-width: 18px; height: 18px; font-size: 11px; line-height: 18px; padding: 0 5px; font-weight: 700; }
#notifPanel { position: absolute; top: 52px; right: 0; width: 320px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.18); overflow: hidden; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
.notif-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.notif-item:last-child { border-bottom: none; }
.notif-item .x { background: none; border: none; color: var(--muted); font-size: 16px; padding: 0 4px; cursor: pointer; }
.notif-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }
