:root {
  --blue: #2563eb;
  --blue-dark: #1e3a8a;
  --ink: #0f172a;
  --gray: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
.center-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px;
  width: 100%;
  max-width: 360px;
}
.card h1 { font-size: 20px; margin: 0 0 4px; }
.card p.sub { color: var(--gray); margin: 0 0 20px; font-size: 14px; }
label { display: block; font-size: 13px; color: var(--gray); margin-bottom: 4px; }
input, select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 15px;
  margin-bottom: 14px;
}
button {
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
}
button:hover { background: var(--blue-dark); }
button.secondary { background: #fff; color: var(--blue); border: 1px solid var(--blue); }
.error { color: var(--red); font-size: 14px; margin-bottom: 10px; }

/* App shell */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar nav { display: flex; flex-wrap: wrap; }
.topbar .brand { font-weight: 700; }
.topbar nav a {
  color: var(--gray);
  text-decoration: none;
  margin-left: 16px;
  font-size: 14px;
}
.topbar nav a.active { color: var(--blue); font-weight: 600; }
main { padding: 16px; max-width: 900px; margin: 0 auto; }

#sync-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  background: #f1f5f9;
}
.status-ok { color: var(--green); }
.status-pending { color: var(--amber); }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { background: #f1f5f9; color: var(--gray); font-weight: 600; }

.att-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.att-status button { padding: 6px 12px; font-size: 13px; margin-left: 6px; background: #fff; color: var(--gray); border: 1px solid var(--line); }
.att-status button.active-present { background: var(--green); color: #fff; border-color: var(--green); }
.att-status button.active-absent { background: var(--red); color: #fff; border-color: var(--red); }
.att-status button.active-leave { background: var(--amber); color: #fff; border-color: var(--amber); }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .label { color: var(--gray); font-size: 13px; }

.report-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 24px; max-width: 500px; }
.report-card h2 { margin: 0 0 2px; }
.report-card .meta { color: var(--gray); font-size: 13px; margin-bottom: 16px; }
.report-card table { border: 1px solid var(--line); }
.report-card .totals { margin-top: 14px; font-size: 15px; }
.report-card .totals strong { font-size: 18px; }
.grade-badge { display: inline-block; padding: 2px 10px; border-radius: 20px; background: #f1f5f9; font-weight: 600; }

@media print {
  .topbar, .toolbar, .no-print { display: none !important; }
  main { padding: 0; max-width: 100%; }
  .report-card { border: none; padding: 0; }
}
