:root {
  color-scheme: light;
  --bg: #f5f0e6;
  --paper: #fffdf8;
  --ink: #172a46;
  --muted: #526075;
  --line: #e3dbce;
  --accent: #203858;
  --soft: #e9eef4;
  --warm: #f7eddf;
  --radius: 18px;
  font-family: Inter, "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,input,select,textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

button:disabled {
  cursor: default;
}

h1,h2,h3,p {
  margin: 0;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

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

.topbar {
  min-height: 70px;
  padding: 12px clamp(16px,3.5vw,52px);
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #fcf9f2;
}

.brand,.identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand strong,.brand small,.identity strong,.identity small {
  display: block;
}

.brand strong {
  font-size: 19px;
  line-height: 1.12;
  letter-spacing: -.06em;
}

.brand strong span {
  color: var(--muted);
}

.brand small,.identity small {
  font-size: 11px;
  margin-top: 3px;
}

.identity {
  justify-content: end;
  font-size: 13px;
}

.brand-mark,.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  flex: none;
}

.brand-mark {
  background: var(--accent);
}

.brand-mark span {
  position: relative;
  width: 20px;
  height: 20px;
  border: 1.6px solid white;
  border-radius: 50%;
}

.brand-mark span::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 4px;
  width: 5px;
  height: 5px;
  border-left: 1.6px solid white;
  border-bottom: 1.6px solid white;
}

.avatar {
  background: var(--soft);
  color: var(--accent);
  font-weight: 750;
}

.switcher {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 3px;
}

.switcher button {
  white-space: nowrap;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 650;
}

.switcher button[aria-pressed=true] {
  background: var(--paper);
  color: var(--accent);
  box-shadow: 0 1px 3px #172a4620;
}

.workspace {
  max-width: 1460px;
  margin: auto;
  padding: clamp(26px, 4vw, 52px) clamp(16px, 3.5vw, 52px) 52px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin: 0 0 28px;
}

.page-heading h1 {
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.04;
  letter-spacing: -.06em;
}

.page-heading p {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}

.preview-label {
  align-self: end;
  padding-bottom: 2px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.student-grid {
  display: grid;
  grid-template-columns: minmax(176px, 1fr) minmax(0, 2.55fr) minmax(228px, 1.14fr);
  gap: clamp(14px, 1.6vw, 24px);
  align-items: start;
}

.card {
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.lesson-sheet {
  box-shadow: 0 12px 30px -28px #172a4680;
}

.lesson-timeline {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.timeline-heading, .lesson-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.timeline-heading {
  min-height: 38px;
  padding: 0 2px;
}

.timeline-heading h2 {
  font-size: 19px;
  letter-spacing: -.03em;
}

.lesson-timeline > .outline {
  justify-self: center;
}

.lesson-entry-title {
  font-size: inherit;
}

.lesson-toggle {
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
  padding: 14px clamp(15px, 3vw, 30px);
  color: var(--ink);
}

.lesson-toggle:hover {
  background: var(--bg);
}

.lesson-toggle:focus-visible {
  outline-offset: -3px;
}

.lesson-toggle time {
  font-size: clamp(16px, 2vw, 21px);
  font-weight: 650;
  letter-spacing: -.035em;
}

.chevron {
  width: 8px;
  height: 8px;
  flex: none;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-right: 2px;
}

.lesson-toggle[aria-expanded=true] .chevron {
  transform: rotate(225deg);
}

.document.lesson-body {
  max-width: none;
  padding: 15px clamp(15px, 3vw, 30px) 19px;
  border-top: 1px solid var(--line);
}

.lesson-body h4 {
  font-size: 13px;
  margin: 0 0 6px;
}

.lesson-controls {
  margin-bottom: 14px;
}

.lesson-preview {
  display: block;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
}

.lesson-preview:hover {
  background: var(--soft);
}

.lesson-preview-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.lesson-assignments {
  margin-top: 14px;
}

.lesson-assignments .exercise + .exercise {
  margin-top: 8px;
}

.lesson-assignments .exercise .outline, .lesson-assignments .exercise a {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
}

.lesson-controls [aria-pressed=true] {
  background: var(--soft);
  border-color: #d2ddeb;
}

.folder-list {
  list-style: none;
  padding: 0 15px 12px;
  margin: 0;
}

.folder-row {
  padding: 10px 2px;
  overflow-wrap: anywhere;
}

.folder-row + .folder-row {
  border-top: 1px solid var(--line);
}

.folder-title {
  display: flex;
  gap: 9px;
  align-items: center;
  font-size: 13px;
}

.folder-icon {
  position: relative;
  flex: none;
  width: 17px;
  height: 12px;
  border: 1px solid #667b96;
  border-radius: 2px;
  background: var(--soft);
}

.folder-icon::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -1px;
  width: 7px;
  height: 3px;
  border: 1px solid #667b96;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
}

.folder-row small {
  display: block;
  margin-top: 5px;
  font-size: 12px;
}

.folder-action {
  margin-top: 7px;
}

.folder-action:disabled {
  color: var(--muted);
  opacity: .7;
}

.empty.no-folders {
  padding-inline: 18px;
}

.folder-choices {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.folder-choice {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
}

.folder-choice input {
  accent-color: var(--accent);
}

.assignment-target {
  margin: 0 15px 4px;
  padding: 8px;
  border-radius: 7px;
  background: var(--soft);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.student-picker {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 650;
}

.student-picker select {
  max-width: min(260px, 85vw);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
  color: var(--ink);
  background: var(--paper);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 19px 18px 14px;
}

.card-head h2 {
  font-size: 16px;
  letter-spacing: -.03em;
}

.count {
  background: var(--warm);
  padding: 3px 7px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 11px;
}

.task-list {
  display: grid;
  gap: 4px;
  padding: 0 8px 9px;
}

.task {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  padding: 11px 9px;
  display: flex;
  gap: 8px;
  align-items: start;
}

.task:hover {
  background: var(--bg);
}

.task[aria-current=true] {
  background: var(--soft);
  border-color: #dae3ec;
}

.task strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.task small {
  font-size: 11px;
}

.task-icon {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 1px solid #8495ab;
  color: var(--accent);
  border-radius: 4px;
  font-size: 10px;
  flex: none;
  margin-top: 1px;
}

.task-icon.reviewed {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
}

.task-icon.submitted {
  background: var(--warm);
  border-color: #a77e4b;
}

.lesson-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 11px clamp(15px, 2vw, 24px);
  border-bottom: 1px solid var(--line);
  background: #fcf9f2;
  font-size: 13px;
  font-weight: 650;
}

.lesson-bar select {
  max-width: 75%;
  font-size: 13px;
  padding: 6px 8px;
}

.document {
  max-width: 700px;
  margin: auto;
  padding: clamp(22px, 3.15vw, 48px);
}

.document .lesson-date {
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  margin-bottom: 9px;
}

.document h2 {
  font-size: clamp(29px, 3.6vw, 47px);
  line-height: 1.06;
  letter-spacing: -.055em;
  margin-bottom: 9px;
}

.document h3 {
  font-size: 16px;
  margin-bottom: 7px;
}

.document p {
  font-size: 15px;
  line-height: 1.65;
}

.document .lesson-summary {
  color: var(--muted);
}

.lesson-notes {
  margin: 24px 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.lesson-example {
  margin-top: 12px;
  padding: 6px 0 6px 12px;
  border-left: 2px solid #899db5;
  font-style: italic;
}

.exercise {
  background: #f9f5ed;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(14px, 2vw, 20px);
}

.exercise-heading {
  margin-bottom: 7px;
}

.exercise-heading h3 {
  margin: 0;
}

.exercise p,.lesson-content {
  white-space: pre-wrap;
}

.exercise .form-label {
  margin-top: 14px;
}

.row {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
}

.between {
  justify-content: space-between;
}

.status {
  display: inline-block;
  padding: 4px 8px;
  background: #ece5d9;
  border-radius: 100px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.status.submitted {
  background: #f1e3cc;
  color: #654925;
}

.status.reviewed {
  background: var(--soft);
  color: var(--accent);
}

.calendar {
  padding: 0 16px 17px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1px 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.icon-btn,.outline,.primary {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-weight: 650;
  font-size: 13px;
  padding: 8px 11px;
}

.icon-btn {
  padding: 3px 8px;
  font-size: 17px;
  min-width: 29px;
}

.icon-btn:hover,.outline:hover {
  background: var(--soft);
}

.primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.primary:hover {
  background: #142844;
}

.primary:disabled {
  opacity: .55;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7,minmax(0,1fr));
  gap: 2px;
  text-align: center;
}

.weekday {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  padding: 4px 0;
}

.day {
  position: relative;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  padding: 0 0 2px;
}

.day:hover {
  background: var(--soft);
}

.day[aria-pressed=true] {
  background: var(--accent);
  color: var(--paper);
}

.day.today {
  font-weight: 800;
}

.day.has-meeting::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
  bottom: 3px;
  left: calc(50% - 2px);
}

.meeting-list {
  border-top: 1px solid var(--line);
  margin-top: 13px;
  padding-top: 13px;
}

.meeting-list h3 {
  font-size: 12px;
  margin-bottom: 8px;
}

.meeting {
  display: flex;
  gap: 10px;
  align-items: center;
  border-radius: 10px;
  background: var(--warm);
  padding: 10px;
  margin: 6px 0;
}

.meeting-day {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--paper);
  color: var(--accent);
  font-size: 15px;
  font-weight: 750;
}

.meeting strong,.meeting small {
  display: block;
  font-size: 12px;
}

.meeting small {
  margin-top: 3px;
  font-size: 11px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(176px, 1fr) minmax(0, 3.69fr);
  gap: clamp(14px, 1.6vw, 24px);
  align-items: start;
}

.admin-panel {
  padding: clamp(15px, 2vw, 25px);
}

.admin-panel>.row {
  margin-bottom: 15px;
}

.admin-panel h2 {
  font-size: 20px;
  letter-spacing: -.03em;
}

.records {
  display: grid;
  gap: 8px;
}

.record {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 13px;
  display: flex;
  align-items: center;
  gap: 9px;
  justify-content: space-between;
}

.record strong,.record small {
  display: block;
}

.record small {
  margin-top: 4px;
}

.record.folder-record {
  display: block;
}

.folder-record h3 {
  font-size: 16px;
}

.folder-record ol {
  margin: 10px 0 0;
  padding-left: 26px;
}

.folder-record li + li {
  margin-top: 9px;
}

.submission {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.empty {
  font-size: 13px;
  color: var(--muted);
  padding: 10px 6px;
}

.form-label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  font-weight: 650;
  margin: 0 0 10px;
}

.form-label input,.form-label textarea,.form-label select,.lesson-bar select {
  border: 1px solid #c7c3b9;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  min-width: 0;
}

.form-label input,.form-label textarea,.form-label select {
  padding: 9px;
  width: 100%;
}

.form-label textarea {
  min-height: 92px;
  font-weight: 400;
  line-height: 1.5;
  resize: vertical;
}

dialog {
  width: min(470px,calc(100% - 26px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--paper);
  padding: 22px;
}

dialog::backdrop {
  background: #172a4666;
}

dialog h2 {
  margin-bottom: 18px;
  font-size: 22px;
}

#lesson-editor[open] {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--bg);
}

.editor-shell {
  min-height: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}

.editor-shell:fullscreen {
  overflow: auto;
  background: var(--bg);
}

.editor-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 12px clamp(12px, 3vw, 36px);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.editor-header h2 {
  margin: 0;
  font-size: clamp(16px, 2vw, 22px);
}

.editor-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.editor-close {
  margin-left: auto;
}

.editor-tools [aria-pressed=true] {
  background: var(--accent);
  color: var(--paper);
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 28%);
  align-items: start;
  gap: clamp(12px, 2vw, 26px);
  padding: clamp(12px, 3vw, 36px);
}

#editor-note, #editor-drawing, .editor-task-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

#editor-note {
  display: block;
  width: 100%;
  min-height: 300px;
  height: calc(100dvh - 140px);
  padding: clamp(14px, 3vw, 36px);
  color: var(--ink);
  font-size: clamp(23px, 3vw, 42px);
  line-height: 1.45;
  resize: vertical;
}

#editor-note[hidden] {
  display: none;
}

#editor-drawing {
  padding: 8px;
}

#lesson-canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
}

.editor-task-panel {
  padding: clamp(12px, 2vw, 22px);
  overflow-wrap: anywhere;
}

.editor-task-panel h3 {
  margin-bottom: 10px;
}

#editor-assignments {
  display: grid;
  gap: 8px;
  font-size: 16px;
  line-height: 1.5;
}

#editor-assignments .exercise a, #editor-assignments .exercise button {
  margin-top: 8px;
}

#editor-save-status {
  margin-top: 8px;
}

@media (max-width: 700px) {
  .editor-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  #editor-note {
    min-height: 220px;
    height: 48dvh;
  }

  .editor-tools {
    order: 1;
    width: 100%;
  }
}

.toast {
  position: fixed;
  z-index: 2;
  bottom: 16px;
  right: 16px;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  background: var(--accent);
  color: white;
  border-radius: 9px;
  font-size: 14px;
}

@media (max-width: 930px) {
  .student-grid {
    grid-template-columns: minmax(175px,1fr) minmax(0,2.45fr);
  }
  .student-calendar {
    grid-column: 1/-1;
  }
  .calendar {
    max-width: 480px;
  }
}

@media (max-width: 630px) {
  .topbar {
    padding: 8px 12px;
    gap: 6px;
    grid-template-columns: 1fr auto;
    position: static;
  }
  .switcher {
    grid-column: 1 / -1;
    grid-row: 2;
    width: max-content;
  }
  .identity>div:last-child {
    display: none;
  }
  .brand small {
    display: none;
  }
  .brand-mark,.avatar {
    width: 30px;
    height: 30px;
  }
  .brand {
    gap: 5px;
  }
  .brand strong {
    font-size: 16px;
  }
  .switcher button {
    padding: 5px 7px;
  }
  .workspace {
    padding-top: 22px;
  }
  .page-heading {
    align-items: start;
    flex-wrap: wrap;
  }
  .preview-label {
    display: none;
  }
  .student-grid,.admin-layout {
    grid-template-columns: minmax(0,1fr);
    gap: 12px;
  }
  .student-calendar {
    grid-column: auto;
  }
  .record {
    align-items: start;
    flex-wrap: wrap;
  }
}
[hidden] {
  display: none !important;
}

.auth-view {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: min(100%, 410px);
  padding: clamp(22px, 5vw, 36px);
}

.auth-card h1 {
  font-size: clamp(25px, 5vw, 34px);
  letter-spacing: -.045em;
  margin-bottom: 12px;
}

#auth-status, #session-status {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

#auth-status:not(:empty) {
  margin-bottom: 14px;
}

#auth-form button, .auth-actions button {
  width: 100%;
}

.auth-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.auth-link {
  padding: 5px;
  border: 0;
  background: transparent;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 13px;
}

.session-controls {
  display: flex;
  justify-content: end;
  align-items: center;
  gap: 8px;
}

#session-status {
  grid-column: 1 / -1;
}

#session-status:empty {
  display: none;
}
.agenda-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
  gap: 16px;
  align-items: start;
}

.agenda-card {
  padding: clamp(16px, 3vw, 24px);
  display: grid;
  gap: 12px;
}

.agenda-card h2 {
  font-size: 19px;
}

.agenda-card > button {
  justify-self: start;
}

.agenda-events {
  list-style: none;
  padding: 0;
  margin: 0;
}

.agenda-events li {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.switcher {
  flex-wrap: wrap;
  max-width: 100%;
}
