:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #17202a;
  --muted: #687385;
  --line: #dde3ea;
  --primary: #1769aa;
  --primary-dark: #0f4f82;
  --success: #147a3f;
  --danger: #b42318;
  --warning: #9a6700;
  --shadow: 0 8px 24px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--primary);
}

.site-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-links a,
.link-button {
  border: 0;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
}

.nav-links a.active,
.nav-links a:hover,
.link-button:hover {
  background: #edf3f8;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 8px 10px;
  border-radius: 6px;
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.hero,
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.hero {
  min-height: 260px;
  display: grid;
  align-content: center;
}

h1,
h2,
h3 {
  margin: 0 0 12px;
  line-height: 1.2;
}

p {
  margin: 0 0 16px;
}

.muted {
  color: var(--muted);
}

.actions,
.form-row,
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
}

.stack {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.button,
button {
  min-height: 44px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.button.secondary,
button.secondary {
  background: #fff;
  color: var(--primary);
}

.button.danger,
button.danger {
  background: var(--danger);
  border-color: var(--danger);
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.message {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
}

.message:empty {
  display: none;
}

.message.info {
  background: #edf3f8;
  border-color: #c6d9ea;
}

.message.success {
  background: #ecfdf3;
  border-color: #b7ebc9;
  color: var(--success);
}

.message.warning {
  background: #fff8e6;
  border-color: #f1d48a;
  color: var(--warning);
}

.message.error {
  background: #fff0ee;
  border-color: #ffc9c2;
  color: var(--danger);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f0f3f7;
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

.status-present {
  color: var(--success);
  font-weight: 700;
}

.status-absent {
  color: var(--danger);
  font-weight: 700;
}

.student-list {
  display: grid;
  gap: 8px;
}

.student-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.student-row input {
  width: 26px;
  height: 26px;
  min-height: 26px;
}

.counts {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-weight: 700;
}

.pill {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2f6;
  font-size: 13px;
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 32, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: min(460px, 100%);
  background: #fff;
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 760px) {
  .nav-inner {
    align-items: flex-start;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-inner {
    flex-wrap: wrap;
  }

  .nav-links a,
  .link-button {
    width: 100%;
    text-align: left;
  }

  .hero,
  .card {
    padding: 18px;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .actions .button,
  .actions button,
  .toolbar button {
    width: 100%;
  }
}
