:root {
  --sidebar-blue: #0d4585;
  --tab-blue: #0f6fff;
  --page-bg: #f5f5f7;
  --card-bg: #ffffff;
  --line: #e4e7ec;
  --text-main: #222;
  --success-bg: #e9f8d8;
  --success-text: #329126;
  --pending-bg: #f4f4f5;
  --pending-text: #4a4a4a;
  --danger-bg: #ffe6e6;
  --danger-text: #b42318;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  background: var(--page-bg);
}

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--sidebar-blue);
  color: #fff;
  padding: 14px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.18);
}

.brand__logo {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #fff;
  color: var(--sidebar-blue);
  display: grid;
  place-content: center;
  font-weight: 700;
}

.brand__text p { margin: 0; font-weight: 600; font-size: 14px; }
.brand__text small { opacity: 0.9; }

nav { margin-top: 12px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: #d8e6ff;
  text-decoration: none;
  font-weight: 500;
}

.nav-link--active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: 0 10px 10px 0;
}

.main-shell { flex: 1; display: flex; flex-direction: column; }

.topbar {
  height: 58px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
}

.profile-pill {
  background: #eaf2ff;
  color: #12396b;
  border-radius: 999px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.icon-btn,
.back-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  color: #2e2e2e;
}

.content { padding: 26px 36px; }

.course-title-row { display: flex; align-items: center; gap: 10px; }
.course-title-row h1 { margin: 0; font-size: 38px; }

.tabs {
  margin-top: 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 20px;
}

.tab {
  border: 0;
  background: transparent;
  font-size: 17px;
  color: #404040;
  padding: 10px 0 12px;
  cursor: pointer;
}

.tab--active { color: var(--tab-blue); border-bottom: 3px solid var(--tab-blue); }

.panel { display: none; margin-top: 22px; }
.panel--active { display: block; }

.panel-header { display: flex; justify-content: space-between; align-items: center; }
.panel-header h2 { margin: 0; }

#monthPicker,
.class-form input,
.class-form textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font: inherit;
}

.calendar-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(7, minmax(70px, 1fr));
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.calendar-cell {
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 72px;
  padding: 6px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calendar-cell strong { font-size: 14px; }
.calendar-cell--muted { background: #fafafa; color: #9aa4b2; }
.calendar-cell--class { border-color: #91b6ff; background: #edf4ff; cursor: pointer; }

.class-dot {
  display: inline-block;
  width: fit-content;
  padding: 2px 6px;
  border-radius: 999px;
  background: #d9e8ff;
  color: #1f4f99;
  font-size: 11px;
}

.calendar-help { margin: 8px 0 0; color: #475467; font-size: 13px; }

.class-form {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
}

.class-form h3 { margin: 0 0 12px; }

.class-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
}

.class-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.full-width { grid-column: 1 / -1; }

.primary-btn {
  margin-top: 12px;
  border: 0;
  background: var(--tab-blue);
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

#attendanceSection.panel--active {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
}

.table-card,
.details-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.table-card table { width: 100%; border-collapse: collapse; }

th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

th { font-weight: 500; background: #fff; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f9fafb; }
tbody tr.row--active { background: #edf4ff; }

input[type='checkbox'] { width: 18px; height: 18px; }

.badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid transparent;
}

.badge--registered { background: var(--success-bg); color: var(--success-text); border-color: #9ed37d; }
.badge--pending { background: var(--pending-bg); color: var(--pending-text); border-color: #d0d5dd; }

.table-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 30px;
  padding: 16px 20px;
  font-size: 15px;
}

.details-card { padding: 16px; }
.details-card h3 { margin-top: 0; }
.hidden { display: none; }

.details-meta { margin-bottom: 10px; }
.details-meta p { margin: 0; font-weight: 600; }
.details-meta small { color: #475467; }

.student-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.student-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.student-status {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.student-status button {
  border: 0;
  padding: 6px 8px;
  cursor: pointer;
  background: #fff;
  font-size: 12px;
}

.student-status button.active-present { background: var(--success-bg); color: var(--success-text); }
.student-status button.active-absent { background: var(--danger-bg); color: var(--danger-text); }

@media (max-width: 1250px) {
  #attendanceSection.panel--active { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar { width: 180px; }
  .content { padding: 18px; }
  .course-title-row h1 { font-size: 28px; }
  .calendar-grid { grid-template-columns: repeat(2, 1fr); }
  .class-form-grid { grid-template-columns: 1fr; }
}
