* { box-sizing: border-box; }
body { font-family: "Segoe UI", system-ui, sans-serif; margin: 0; background: #f4f6fa; color: #1f2630; }
header { background: #0f6440; color: #fff; padding: 14px 22px; display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
header h1 { margin: 0; font-size: 20px; }
nav { display: flex; gap: 6px; flex-wrap: wrap; }
nav button { background: rgba(255,255,255,.12); color: #fff; border: none; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 14px; }
nav button.active { background: #fff; color: #0f6440; font-weight: 600; }
main { max-width: 960px; margin: 24px auto; padding: 0 16px; }
.tab { display: none; }
.tab.active { display: block; }
h2 { margin: 6px 0 14px; font-size: 20px; }
h3 { margin: 18px 0 8px; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #e6e9ef; font-size: 14px; }
th { background: #eef1f6; }
.badge-qr { display: inline-flex; align-items: center; gap: 6px; }
.badge-qr img { image-rendering: pixelated; border: 1px solid #e6e9ef; border-radius: 4px; }
.badge-qr button { padding: 4px 8px; font-size: 12px; }
.pass-cell { display: inline-flex; align-items: center; gap: 6px; }
.pass-label { color: #5b6573; font-size: 13px; }
.pass-cell button { padding: 4px 8px; font-size: 12px; }
button { padding: 8px 12px; border: 1px solid #c8cfda; border-radius: 6px; background: #fff; cursor: pointer; font-size: 14px; }
button.primary { background: #0f6440; border-color: #0f6440; color: #fff; }
button.danger { background: #b3261e; border-color: #b3261e; color: #fff; }
button.ghost { background: transparent; border-color: transparent; color: #0f6440; }
button.delete { background: transparent; border: none; color: #b3261e; text-decoration: underline; cursor: pointer; }
.inline-form { display: flex; gap: 8px; margin: 12px 0 18px; flex-wrap: wrap; }
.inline-form input { padding: 8px 10px; border: 1px solid #c8cfda; border-radius: 6px; font-size: 14px; min-width: 200px; }
.hint { color: #5b6573; font-size: 13px; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 12px; }
.qr-card { background: #fff; border-radius: 10px; padding: 16px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.qr-card img { width: 180px; height: 180px; image-rendering: pixelated; }
.qr-card .code { font-weight: 700; margin-top: 8px; }
.qr-card .name { color: #5b6573; font-size: 13px; }
.qr-card button { margin-top: 8px; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.stat { background: #fff; padding: 12px 16px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.stat b { font-size: 20px; display: block; }
.filter { display: block; margin: 0 0 12px; font-size: 14px; color: #1f2630; }
.filter input { padding: 6px 8px; border: 1px solid #c8cfda; border-radius: 6px; }
textarea { width: 100%; border: 1px solid #c8cfda; border-radius: 8px; padding: 10px; font-family: Consolas, monospace; font-size: 13px; }
.btn-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.type-IN { color: #0f6440; font-weight: 600; }
.type-OUT { color: #b3261e; font-weight: 600; }
.status-ontime { color: #0f6440; font-weight: 600; }
.status-late { color: #b3261e; font-weight: 600; }
@media print {
  header, nav, .ghost, h2, .hint, #print-qr { display: none !important; }
  .qr-grid { grid-template-columns: repeat(3, 1fr); }
  .qr-card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}