* {
  box-sizing: border-box;
}
:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4f;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --primary: #58a6ff;
  --primary-hover: #79b8ff;
  --success: #3fb950;
  --error: #f85149;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  max-width: 420px;
  width: 100%;
}
.login-page .card {
  max-width: 380px;
}
.card h1, .card h2, .card h3, .card h4 {
  margin-top: 0;
  margin-bottom: 0.5em;
}
.subtitle {
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.form label {
  display: block;
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.form input, .form select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
.form button {
  margin-top: 1.25rem;
  width: 100%;
}
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}
.inline-form label { margin-top: 0; }
.inline-form select { min-width: 180px; }
.inline-form .btn { margin-top: 0; width: auto; }
.btn {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 500;
}
.btn-primary {
  background: var(--primary);
  color: var(--bg);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--primary); }
.error {
  color: var(--error);
  font-size: 0.9rem;
  margin-top: 0.75rem;
}
.hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1rem;
  margin-bottom: 0;
}
.header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.header .brand { font-weight: 600; margin-right: auto; }
.header .user { color: var(--text-muted); font-size: 0.9rem; }
.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
}
.main h2 { margin-bottom: 1rem; }
.qr-section {
  max-width: 420px;
  margin-top: 1.5rem;
}
.qr-section h3 { margin-bottom: 0.25rem; }
.session-expiry {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
#qr-container {
  margin: 1rem 0;
  padding: 1rem;
  background: #fff;
  border-radius: 8px;
  display: inline-block;
}
#qr-container canvas, #qr-container img { display: block; }
.attendance-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}
.attendance-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.attendance-list li:last-child { border-bottom: none; }
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.status { margin-top: 0.75rem; font-size: 0.95rem; }
.status.success { color: var(--success); }
.status.error { color: var(--error); }
#scan-area {
  min-height: 220px;
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}
#scan-area video { width: 100%; display: block; }
.stats-list { display: flex; flex-direction: column; gap: 0.75rem; }
.stat-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.stat-card .label { font-weight: 500; }
.stat-card .value { color: var(--text-muted); }
.stat-card .pct { font-weight: 600; color: var(--primary); }
.growth-list { display: flex; flex-direction: column; gap: 1.5rem; }
.growth-subject {
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.growth-subject h4 { margin-top: 0; margin-bottom: 0.75rem; }
.growth-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.growth-table th, .growth-table td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.growth-table th { color: var(--text-muted); font-weight: 500; }
.growth-bar-wrap {
  margin-top: 0.5rem;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.growth-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.2s ease;
}
.empty-state { color: var(--text-muted); padding: 1rem 0; }
