:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --secondary: #6b7280;
  --bg: #f3f4f6;
  --card-bg: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

/* Nav */
nav {
  background: var(--primary);
  color: white;
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.nav-title { font-weight: 700; font-size: 1.1rem; flex: 1; }
.nav-user { font-size: .85rem; opacity: .85; }

/* Layout */
.container { max-width: 680px; margin: 0 auto; padding: 1rem; }
.center-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }

/* Card */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}
.card h3 { margin-bottom: .75rem; font-size: 1rem; }

.card-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: background .15s;
}
.card-link:hover { background: #f9fafb; }
.class-name { flex: 1; font-weight: 600; }
.class-year { color: var(--muted); font-size: .9rem; }
.arrow { font-size: 1.4rem; color: var(--muted); }

/* Login */
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { text-align: center; margin-bottom: 1.25rem; font-size: 1.4rem; color: var(--primary); }

/* Forms */
label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: .25rem; margin-top: .75rem; }
label:first-of-type { margin-top: 0; }
input[type="text"],
input[type="number"],
input[type="password"],
select {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  background: white;
  appearance: none;
}
input:focus, select:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: normal;
  margin-top: .35rem;
}
.checkbox-label input { width: auto; }

.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; margin-top: .75rem; }
.inline-form input { flex: 1; min-width: 120px; }

.year-form { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.year-form label { margin: 0; font-weight: 600; }
.year-form input { width: 90px; }

.btn-row { display: flex; gap: .5rem; margin-top: 1rem; }

/* Buttons */
.btn {
  display: inline-block;
  padding: .6rem 1rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #e5e7eb; color: var(--text); }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-dark); }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }
.btn-full { width: 100%; }
.btn-link { background: none; border: none; color: white; cursor: pointer; font-size: .85rem; text-decoration: underline; padding: 0; }

/* Alerts */
.alert { padding: .75rem; border-radius: 6px; margin-bottom: .75rem; font-size: .9rem; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* Page header */
.page-header { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.page-header h2 { margin: 0; }
.back-link { color: var(--primary); text-decoration: none; font-weight: 600; font-size: .95rem; }

/* Item list */
.item-list { list-style: none; }
.item-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  gap: .5rem;
}
.item-list li:last-child { border-bottom: none; }

/* Table */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { background: var(--bg); text-align: center; padding: .4rem .5rem; font-size: .8rem; border-bottom: 2px solid var(--border); }
th:first-child { text-align: left; }
td { padding: .4rem .5rem; border-bottom: 1px solid var(--border); text-align: center; }
td:first-child { text-align: left; font-weight: 500; }

.att-cell { text-align: center; }
.att-cell.present { color: #16a34a; font-weight: 700; }
.att-cell.absent { color: #9ca3af; }
.att-cell input[type="checkbox"] { width: 20px; height: 20px; cursor: pointer; }
.total { font-size: .9rem; }

.muted { color: var(--muted); font-size: .9rem; }
