.sidebar {
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  align-self: start;
}

@media (max-width: 900px) {
  .sidebar {
    position: static;
    height: auto;
  }
}

.lesson-edit-button {
  min-height: 36px;
  margin-top: 8px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.11);
  color: #fff;
}

.lesson-edit-button:hover {
  background: rgba(255, 255, 255, 0.17);
}

.lesson-topic small {
  color: #d8e7f8;
}

.homework-list {
  display: grid;
  gap: 14px;
}

.homework-card {
  padding: 18px;
  border: 1px solid #dfe8f4;
  border-radius: 15px;
  background: #f9fbfe;
}

.homework-card__heading,
.submission-item__meta,
.homework-links,
.review-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.homework-card h3 {
  margin: 0 0 5px;
}

.homework-card__heading p,
.submission-item__meta span {
  margin: 0;
  color: #60708e;
  font-size: 12px;
}

.homework-description {
  margin: 14px 0;
}

.homework-links {
  justify-content: flex-start;
}

.homework-links a {
  color: #0d4f91;
  font-size: 13px;
  font-weight: 700;
}

.submission-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.submission-item {
  padding: 13px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e4ebf4;
}

.teacher-comment {
  padding: 9px 11px;
  border-radius: 9px;
  background: #eaf7f9;
}

.review-form {
  align-items: stretch;
  margin-top: 10px;
}

.review-form select,
.review-form input {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #bfccdc;
  border-radius: 9px;
  background: #fff;
}

.review-form input {
  flex: 1 1 220px;
}

.submit-homework {
  margin-top: 14px;
}

.submit-homework summary,
.add-homework summary {
  cursor: pointer;
  color: #0d4f91;
  font-weight: 750;
}

.program-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 18px;
  margin: 0 0 18px;
  padding: 15px 18px;
  border: 1px solid #cfe0f3;
  border-radius: 14px;
  background: #f1f6fc;
  color: #0b3769;
  text-decoration: none;
}

.program-banner span,
.program-banner small {
  color: #60708e;
  font-size: 12px;
}

.program-banner strong {
  font-size: 17px;
}

.program-banner small {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}

.program-modules {
  display: grid;
  gap: 16px;
}

.program-module {
  border-left: 4px solid #10c7d4;
}

.topic-list {
  display: grid;
  gap: 9px;
  margin: 16px 0 0;
  padding: 0;
  counter-reset: program-topic;
  list-style: none;
}

.topic-list li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 2px 10px;
  padding: 11px 13px;
  border-radius: 11px;
  background: #f5f8fc;
  counter-increment: program-topic;
}

.topic-list li::before {
  grid-row: 1 / span 2;
  content: counter(program-topic);
  color: #0d78a0;
  font-weight: 800;
}

.topic-list span {
  color: #60708e;
  font-size: 13px;
}

@media (max-width: 620px) {
  .program-banner {
    grid-template-columns: 1fr;
  }

  .program-banner small {
    grid-column: auto;
    grid-row: auto;
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --navy: #e8f2ff;
  --blue: #55a7ff;
  --cyan: #25d6e6;
  --line: #2a3d58;
  --muted: #9fb0c8;
  --surface: #121f31;
  color: #e8f2ff;
  background: #091321;
}

html[data-theme="dark"] body {
  background: #091321;
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .mobile-nav {
  background: #071326;
}

html[data-theme="dark"] .sidebar {
  border-color: #24364e;
}

html[data-theme="dark"] .sidebar a:hover,
html[data-theme="dark"] .segmented,
html[data-theme="dark"] .button--ghost,
html[data-theme="dark"] .task-card__meta span,
html[data-theme="dark"] .attendance-options label span,
html[data-theme="dark"] .notification-note {
  background: #1b2c43;
  color: #d9e8fa;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .upcoming-panel,
html[data-theme="dark"] .tile,
html[data-theme="dark"] .entity-card,
html[data-theme="dark"] .task-card,
html[data-theme="dark"] .calendar-card,
html[data-theme="dark"] .submission-item {
  border-color: #2a3d58;
  background: #121f31;
  box-shadow: 0 14px 40px #0005;
}

html[data-theme="dark"] .segmented a.active,
html[data-theme="dark"] .homework-card,
html[data-theme="dark"] .topic-list li,
html[data-theme="dark"] .program-banner {
  border-color: #2a4860;
  background: #172941;
  color: #e8f2ff;
}

html[data-theme="dark"] .form-stack input,
html[data-theme="dark"] .form-stack select,
html[data-theme="dark"] .form-stack textarea,
html[data-theme="dark"] .filter-bar input,
html[data-theme="dark"] .filter-bar select,
html[data-theme="dark"] .task-status select,
html[data-theme="dark"] .review-form select,
html[data-theme="dark"] .review-form input {
  border-color: #3b506c;
  background: #0d1929;
  color: #eef6ff;
}

html[data-theme="dark"] .weekdays {
  border-color: #2a3d58;
  background: #17263a;
}

html[data-theme="dark"] .calendar-day {
  border-color: #263950;
  background: #121f31;
}

html[data-theme="dark"] .calendar-day.outside {
  background: #0d1827;
  color: #65768d;
}

html[data-theme="dark"] .calendar-day.today {
  background: #133342;
}

html[data-theme="dark"] .lesson-chip {
  background: #183b5c;
  color: #e8f2ff;
}

html[data-theme="dark"] .lesson-chip.completed {
  background: #173c31;
}

html[data-theme="dark"] .lesson-chip.cancelled,
html[data-theme="dark"] .badge {
  background: #293546;
  color: #b9c6d8;
}

html[data-theme="dark"] .badge--success {
  background: #17452f;
  color: #8ee7bb;
}

html[data-theme="dark"] th,
html[data-theme="dark"] td,
html[data-theme="dark"] .list-link,
html[data-theme="dark"] .material-item,
html[data-theme="dark"] .audit-row {
  border-color: #263950;
}

html[data-theme="dark"] .click-row:hover,
html[data-theme="dark"] .document-row:hover {
  background: #172941;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.table-actions form {
  margin: 0;
}

.table-actions .button {
  min-height: 34px;
  padding: 0 11px;
}

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

.audit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid #e7edf5;
}

.audit-row:last-child {
  border-bottom: 0;
}

.audit-row div {
  display: grid;
  gap: 2px;
}

.audit-row span,
.audit-row small {
  color: #60708e;
}

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

.document-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid #dfe8f4;
  border-radius: 11px;
  color: #0b3769;
  text-decoration: none;
}

.document-row:hover {
  border-color: #77cfd8;
  background: #f6fcfd;
}

.document-row div {
  display: grid;
  gap: 3px;
}

.document-row div span {
  color: #60708e;
  font-size: 12px;
}

.document-filter input {
  flex: 1 1 320px;
}

.document-filter select {
  max-width: 220px;
}

.settings-link {
  color: #fff;
  text-decoration: none;
}

.notification-note {
  padding: 14px;
  border-radius: 12px;
  background: #f3f7fc;
}

.notification-note span {
  color: #60708e;
  font-size: 13px;
}

.student-access-actions,
.relationship-flags,
.linked-student > div {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.schedule-mode {
  margin-top: -6px;
}

.week-view .calendar-day {
  min-height: 240px;
}

.week-view .day-number span {
  display: grid;
  gap: 2px;
}

.week-view .day-number b {
  color: #60708e;
  font-size: 11px;
  text-transform: uppercase;
}

.week-view .lesson-chip {
  padding: 9px;
}

.no-lessons {
  padding: 8px 2px;
  color: #98a5b8;
}

.student-access-actions {
  margin-top: 18px;
}

.student-access-actions form {
  margin: 0;
}

.representative-list {
  display: grid;
  gap: 9px;
}

.representative-row,
.legacy-contact,
.linked-student {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid #dfe8f4;
  border-radius: 12px;
  text-decoration: none;
}

.representative-row > div:first-child,
.legacy-contact,
.linked-student > a {
  display: grid;
  gap: 3px;
}

.representative-row span,
.legacy-contact span,
.legacy-contact small,
.linked-student span {
  color: #60708e;
  font-size: 12px;
}

.relationship-flags span,
.linked-student > div span {
  padding: 4px 7px;
  border-radius: 12px;
  background: #edf6fa;
  color: #0d6681;
  font-weight: 700;
}

.linked-student {
  margin-bottom: 9px;
}

.linked-student > div {
  justify-content: flex-end;
}

@media (max-width: 620px) {
  .representative-row,
  .linked-student {
    align-items: flex-start;
    flex-direction: column;
  }

  .linked-student > div {
    justify-content: flex-start;
  }

  .week-view .weekdays {
    display: none;
  }

  .week-view .calendar-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .week-view .calendar-day {
    min-height: 94px;
    padding: 10px;
    border-right: 0;
  }

  .week-view .day-number {
    justify-content: space-between;
  }

  .week-view .day-number span {
    display: flex;
    align-items: baseline;
    gap: 7px;
    font-size: 13px;
  }

  .week-view .lesson-chip {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 8px 10px;
    text-align: left;
  }

  .week-view .lesson-chip time {
    font-size: 11px;
  }

  .week-view .lesson-chip strong,
  .week-view .lesson-chip span {
    display: block;
  }
}
