:root {
  --bg: #f5f6f4;
  --surface: #fff;
  --ink: #202522;
  --muted: #707872;
  --line: #dde2dc;
  --accent: #3d7d43;
  --accent-2: #4c78a8;
  --danger: #b85c6a;
  --dark: #202020;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

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

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 64px;
  padding: 0 22px;
  border-bottom: 1px solid #333;
  color: #fff;
  background: var(--dark);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #aaa;
}

.session-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-box[hidden] {
  display: none;
}

#userBadge {
  color: #d8d8d8;
  font-weight: 800;
}

.role-tab,
.ghost-button,
.primary-button,
.secondary-button,
.danger-button,
.link-button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 800;
}

.role-tab,
.ghost-button,
.link-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.role-tab {
  border-color: #555;
  background: #2c2c2c;
  color: #eee;
}

.role-tab.active {
  background: #5cc86a;
  color: #102514;
}

.primary-button,
.secondary-button,
.danger-button {
  border: 0;
  color: #fff;
}

.primary-button {
  background: var(--accent);
}

.secondary-button {
  background: var(--accent-2);
}

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

.link-button {
  width: fit-content;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
}

.link-button.light {
  color: #dceedd;
}

.app {
  min-height: calc(100vh - 64px);
}

.auth-page {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 64px);
  padding: 28px;
  background:
    linear-gradient(120deg, rgba(61, 125, 67, 0.11), transparent 38%),
    var(--bg);
}

.auth-panel {
  display: grid;
  gap: 18px;
  width: min(520px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.auth-panel h1 {
  margin-bottom: 0;
  font-size: clamp(32px, 5vw, 48px);
}

.auth-panel p,
.auth-panel small {
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-error {
  color: var(--danger);
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 44px));
  padding: 14px 16px;
  border: 1px solid #c7dccb;
  border-radius: 8px;
  color: #133017;
  background: #eef9f0;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.16);
  font-weight: 800;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-color: #e0b5bd;
  color: #642631;
  background: #fff0f2;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 42px 28px 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1;
}

.page-head p {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.5;
}

.home-tabs {
  display: flex;
  gap: 8px;
  max-width: 1120px;
  margin: 0 auto 18px;
  padding: 0 28px;
}

.home-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-weight: 900;
}

.home-tab strong {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  color: #4c5a50;
  background: #eef1ec;
  font-size: 12px;
}

.home-tab.active {
  border-color: #d6e6d8;
  color: #143b19;
  background: #e8f4ea;
}

.home-tab.active strong {
  color: #102514;
  background: #cfe8d3;
}

.section-hint,
.summary-cards {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px;
}

.section-hint {
  margin-bottom: 14px;
  color: #4d5b52;
  font-weight: 800;
  line-height: 1.45;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.summary-card {
  display: grid;
  gap: 5px;
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.summary-card span,
.summary-card small {
  color: var(--muted);
  font-weight: 800;
}

.summary-card strong {
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
}

.course-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.course-list,
.lesson-list,
.form-wrap {
  display: grid;
  gap: 14px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px 60px;
}

.form-wrap {
  padding-bottom: 18px;
}

.form-wrap[hidden] {
  display: none;
}

.course-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-head {
  padding-top: 10px;
}

.compact-head h1 {
  font-size: 34px;
}

.user-admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px 70px;
}

.managed-students {
  display: grid;
  gap: 14px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px 32px;
}

.student-management-workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px 60px;
}

.managed-student-list,
.managed-student-detail,
.student-detail-section,
.course-task-block {
  display: grid;
  align-content: start;
  gap: 12px;
}

.managed-student-list,
.managed-student-detail {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.selected-student-card {
  border: 0;
  padding: 0;
}

.student-detail-section {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.calendar-page {
  display: grid;
  gap: 20px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 4px 28px 72px;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 96px;
  padding: 22px 24px;
  border: 1px solid #dfe5df;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 252, 250, 0.96)),
    #fff;
  box-shadow: 0 18px 45px rgba(32, 37, 34, 0.08);
}

.calendar-toolbar h2 {
  margin: 2px 0 0;
  font-size: 30px;
  letter-spacing: 0;
}

.calendar-toolbar span {
  color: var(--muted);
  font-weight: 900;
}

.student-schedule-list {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.student-schedule-list h3 {
  margin: 0;
  font-size: 20px;
}

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

.student-lesson-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid #dfe6f3;
  border-left: 4px solid #3f6fd8;
  border-radius: 8px;
  background: #f8fbff;
}

.student-lesson-card strong,
.student-lesson-card span,
.student-lesson-card small {
  display: block;
}

.student-lesson-card span {
  margin-top: 4px;
  color: #315dc4;
  font-weight: 900;
}

.student-lesson-card small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.calendar-controls {
  display: grid;
  grid-template-columns: auto 40px auto 40px minmax(210px, auto);
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.calendar-controls .ghost-button {
  min-width: 40px;
  min-height: 40px;
  border-color: #d9e1da;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(32, 37, 34, 0.06);
}

.calendar-view-switch {
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid #dfe6df;
  border-radius: 12px;
  background: #eef3ef;
}

.calendar-view-switch button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.calendar-view-switch button.active {
  color: #173f1f;
  background: #fff;
  box-shadow: 0 6px 16px rgba(32, 37, 34, 0.08);
}

.calendar-range {
  display: block;
  min-width: 230px;
  padding: 0 2px;
  text-align: right;
  white-space: nowrap;
}

.calendar-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.calendar-sidebar {
  position: sticky;
  top: 84px;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px;
  border: 1px solid #dfe5df;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(32, 37, 34, 0.07);
}

.calendar-sidebar > strong {
  font-size: 13px;
  letter-spacing: 0;
  text-transform: uppercase;
  color: #657069;
}

.calendar-student-list {
  display: grid;
  gap: 10px;
  max-height: 330px;
  padding-right: 4px;
  overflow: auto;
}

.calendar-student {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid #e2e8e2;
  border-radius: 12px;
  color: var(--ink);
  background: #fbfcfb;
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.calendar-student:hover {
  transform: translateY(-1px);
  border-color: #c9d8cc;
  background: #fff;
  box-shadow: 0 10px 24px rgba(32, 37, 34, 0.08);
}

.calendar-student.active {
  border-color: #78b77f;
  background: linear-gradient(180deg, #f2fbf3, #e8f6ea);
  box-shadow: inset 4px 0 0 #3d7d43, 0 10px 24px rgba(61, 125, 67, 0.12);
}

.calendar-student span {
  font-weight: 900;
}

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

.schedule-form {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.google-calendar {
  overflow: hidden;
  border: 1px solid #dfe5df;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(32, 37, 34, 0.08);
}

.calendar-week-head,
.calendar-week-grid {
  display: grid;
  grid-template-columns: 64px repeat(var(--calendar-days, 7), minmax(0, 1fr));
  min-width: 0;
}

.calendar-time-head {
  z-index: 4;
  border-right: 1px solid #e6ebe6;
  border-bottom: 1px solid #e6ebe6;
  background: #fbfcfb;
}

.calendar-day-name {
  display: grid;
  justify-items: center;
  gap: 7px;
  min-height: 82px;
  padding: 14px 8px 12px;
  border-right: 1px solid #edf0ed;
  border-bottom: 1px solid #e6ebe6;
  background: #fbfcfb;
}

.calendar-day-name:last-child,
.calendar-slot:nth-child(8n) {
  border-right: 0;
}

.calendar-day-name span {
  color: #68736b;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.calendar-day-name strong {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 18px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #edf0ed;
}

.calendar-day-name.today strong {
  color: #fff;
  background: #3d7d43;
  box-shadow: none;
}

.calendar-hour-label {
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  height: 104px;
  padding: 10px 8px;
  border-right: 1px solid #e6ebe6;
  border-bottom: 1px solid #edf0ed;
  color: #768078;
  background: #fbfcfb;
  font-size: 13px;
  font-weight: 900;
}

.calendar-slot {
  position: relative;
  display: grid;
  align-content: start;
  gap: 8px;
  height: 104px;
  padding: 0;
  border-right: 1px solid #edf0ed;
  border-bottom: 1px solid #edf0ed;
  background:
    linear-gradient(to bottom, transparent calc(25% - 1px), #f4f7f4 calc(25% - 1px), #f4f7f4 25%, transparent 25%),
    linear-gradient(to bottom, transparent calc(50% - 1px), #f4f7f4 calc(50% - 1px), #f4f7f4 50%, transparent 50%),
    linear-gradient(to bottom, transparent calc(75% - 1px), #f4f7f4 calc(75% - 1px), #f4f7f4 75%, transparent 75%),
    #fff;
  overflow: visible;
}

.calendar-slot.today {
  background:
    linear-gradient(to bottom, transparent calc(25% - 1px), #e8f2ea calc(25% - 1px), #e8f2ea 25%, transparent 25%),
    linear-gradient(to bottom, transparent calc(50% - 1px), #e8f2ea calc(50% - 1px), #e8f2ea 50%, transparent 50%),
    linear-gradient(to bottom, transparent calc(75% - 1px), #e8f2ea calc(75% - 1px), #e8f2ea 75%, transparent 75%),
    #f7fbf8;
}

.calendar-slot-actions {
  position: absolute;
  top: 5px;
  right: 5px;
  bottom: 5px;
  z-index: 9;
  display: grid;
  grid-template-rows: repeat(4, 1fr);
  width: 32px;
  gap: 3px;
  opacity: 0;
  overflow: visible;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.calendar-slot-button {
  min-height: 0;
  height: 100%;
  pointer-events: auto;
  border: 1px solid #cfded1;
  border-radius: 7px;
  color: #2f6f36;
  background: rgba(255, 255, 255, 0.94);
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  padding: 0 2px;
  box-shadow: 0 5px 14px rgba(32, 37, 34, 0.08);
}

.calendar-slot:hover .calendar-slot-actions,
.calendar-slot-actions:focus-within {
  opacity: 1;
}

.calendar-slot-button:hover,
.calendar-slot-button:focus-visible {
  color: #fff;
  background: #3d7d43;
  border-color: #3d7d43;
}

.calendar-event {
  position: absolute;
  top: calc(var(--event-top) * 1%);
  left: calc(6px + 18px * var(--event-column));
  width: calc(100% - 44px - (18px * (var(--event-columns) - 1)));
  z-index: 2;
  display: grid;
  gap: 4px;
  min-height: 38px;
  height: max(38px, calc(var(--event-height) * 1% - 4px));
  overflow: hidden;
  padding: 7px 8px;
  border: 1px solid rgba(61, 125, 67, 0.24);
  border-left: 4px solid #3d7d43;
  border-radius: 10px;
  background: linear-gradient(180deg, #eef9f0, #e3f3e6);
  color: #173f1f;
  font-size: 11px;
  line-height: 1.3;
  box-shadow: 0 8px 20px rgba(32, 37, 34, 0.1);
}

.schedule-event-main {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.calendar-event.open {
  min-height: 112px;
  height: auto;
  overflow: visible;
  z-index: 12;
  background: #fff;
  box-shadow: 0 18px 38px rgba(32, 37, 34, 0.2);
}

.calendar-event.open,
.month-event.open {
  width: min(420px, calc(100vw - 32px));
  max-width: 420px;
}

.month-event.open {
  position: relative;
}

.schedule-popover-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #d6ded7;
  border-radius: 8px;
  color: #56635b;
  background: #fff;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.schedule-popover-close:hover,
.schedule-popover-close:focus-visible {
  color: #8f3340;
  border-color: #f0c3ca;
  background: #fff4f5;
}

.calendar-event strong,
.calendar-event p {
  margin: 0;
}

.calendar-event strong,
.calendar-event span,
.calendar-event small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-event strong {
  display: block;
  white-space: nowrap;
}

.calendar-event span,
.calendar-event small {
  color: #55705a;
}

.schedule-description {
  padding-top: 7px;
  border-top: 1px solid #dbe7dd;
  color: #405647;
}

.schedule-detail-panel {
  display: grid;
  gap: 9px;
  padding: 10px 0;
  border-top: 1px solid #dbe7dd;
  border-bottom: 1px solid #dbe7dd;
}

.schedule-detail-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.schedule-detail-row span {
  color: var(--muted);
  font-weight: 800;
}

.schedule-detail-row strong {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.video-room-link {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #2f6f36;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 8px 16px rgba(47, 111, 54, 0.2);
}

.schedule-delete-button {
  justify-self: start;
  min-height: 28px;
  padding: 0;
  border: 0;
  color: var(--danger);
  background: transparent;
  font-weight: 900;
}

.schedule-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.schedule-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.schedule-status {
  border: 1px solid transparent;
  color: #245c2c;
  background: #e7f5ea;
}

.schedule-status-canceled {
  color: #17456f;
  background: #e1efff;
  text-decoration: line-through;
}

.schedule-status-missed_excused {
  color: #7a5d1f;
  background: #fff4d8;
}

.schedule-status-missed_unexcused,
.schedule-payment-unpaid {
  color: #7f2f25;
  background: #fde9df;
}

.schedule-payment-paid {
  color: #1f6930;
  background: #e7f5ea;
}

.conduct-button {
  justify-self: start;
  min-height: 30px;
  padding: 0 12px;
}

.schedule-popover-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.schedule-popover-actions .primary-button,
.schedule-popover-actions .video-room-link,
.schedule-popover-actions .schedule-delete-button {
  justify-content: center;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.1;
  text-align: center;
}

.schedule-popover-actions .schedule-delete-button {
  border: 1px solid #e0b5bd;
  background: #fff;
}

.conduct-homework-block {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
}

.homework-task-picker {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.homework-task-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  padding: 8px;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 800;
}

.homework-task-option label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  color: inherit;
  font-weight: inherit;
}

.homework-task-option:hover {
  background: #f3f6f3;
}

.homework-task-option input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.homework-preview-button {
  min-height: 30px;
  padding: 0 9px;
}

.homework-task-preview {
  display: grid;
  grid-column: 1 / -1;
  gap: 6px;
  padding: 10px;
  border: 1px solid #dbe6dc;
  border-radius: 8px;
  background: #f8faf7;
}

.homework-task-preview p {
  margin: 0;
  color: #343b36;
  line-height: 1.45;
}

.homework-task-preview small {
  color: var(--muted);
  font-weight: 900;
}

.month-week-head,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.month-week-head div {
  padding: 13px;
  border-right: 1px solid #edf0ed;
  border-bottom: 1px solid #e6ebe6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  background: #fbfcfb;
}

.month-day {
  min-height: 156px;
  padding: 11px;
  border-right: 1px solid #edf0ed;
  border-bottom: 1px solid #edf0ed;
  background: #fff;
}

.month-day.outside {
  background: #f7f8f6;
  color: #9aa39c;
}

.month-day.today {
  background: #f7fbf8;
}

.month-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.month-day-head button {
  width: 28px;
  height: 28px;
  border: 1px solid #c9d8cc;
  border-radius: 50%;
  color: #2f6f36;
  background: #eef8ef;
  font-weight: 900;
}

.month-events {
  display: grid;
  gap: 6px;
}

.month-events > span {
  color: #a0a7a1;
  font-size: 12px;
}

.month-event {
  display: grid;
  gap: 3px;
  padding: 7px 9px;
  border: 1px solid rgba(61, 125, 67, 0.18);
  border-left: 3px solid #3d7d43;
  border-radius: 9px;
  background: #eef9f0;
  color: #173f1f;
  font-size: 12px;
}

.month-event.open {
  background: #fff;
  box-shadow: 0 12px 24px rgba(32, 37, 34, 0.13);
}

.month-event p {
  margin: 4px 0 0;
}

.month-event .video-room-link {
  min-height: 24px;
  padding: 0 8px;
  font-size: 12px;
}

.month-event .schedule-delete-button {
  justify-self: start;
  min-height: 22px;
  padding: 0;
  border: 0;
  color: var(--danger);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
}

.calendar-help {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid #dfe9e0;
  border-radius: 12px;
  background: #f7fbf8;
}

.calendar-help p {
  color: var(--muted);
  line-height: 1.45;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(32, 37, 34, 0.48);
}

.schedule-modal {
  display: grid;
  gap: 14px;
  width: min(620px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 22px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
}

.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.modal-head h2 {
  margin: 0;
  font-size: 24px;
}

.assignment-workbench {
  display: grid;
  grid-template-columns: 280px 280px minmax(0, 1fr);
  gap: 14px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px 42px;
}

.access-course-list,
.assigned-student-list,
.student-task-tree {
  display: grid;
  align-content: start;
  gap: 10px;
}

.assigned-student-list,
.student-task-tree {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.access-course-button,
.assigned-student-button {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.access-course-button.active,
.assigned-student-button.active {
  border-color: var(--accent);
  background: #edf7ee;
  box-shadow: inset 4px 0 0 var(--accent);
}

.access-course-button span,
.assigned-student-button small,
.topic-task-row span,
.task-topic small {
  color: var(--muted);
}

.task-tree-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.task-tree-head h2 {
  margin: 8px 0 0;
  text-align: left;
}

.task-topic {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.task-topic header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.task-topic header > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 900;
}

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

.topic-task-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.topic-task-row p,
.task-text p,
.review-comment p {
  margin: 6px 0 0;
  color: #2c302d;
  line-height: 1.45;
}

.task-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: end;
}

.task-answer-history {
  display: grid;
  grid-column: 1 / -1;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.student-attempt-history {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.student-attempt-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.attempt-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.attempt-meta span {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 6px;
  color: #24662d;
  background: #eaf7ec;
  font-size: 13px;
  font-weight: 900;
}

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

.answer-history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.answer-history-head span {
  color: var(--muted);
  font-size: 14px;
}

.submission-list,
.submission-row {
  display: grid;
  gap: 8px;
}

.submission-summary {
  display: grid;
  grid-template-columns: 170px 100px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.submission-summary.active {
  border-color: var(--accent);
  background: #f0f8f1;
}

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

.task-text,
.review-comment {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
}

.review-comment {
  border-color: #d9e2f0;
  background: #f4f8fc;
}

.student-access-card,
.access-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.student-access-head,
.assign-row,
.access-student-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.student-access-head strong,
.student-access-head span {
  display: block;
}

.student-access-head span,
.muted-text,
.access-student-row small {
  color: var(--muted);
}

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

.access-pill {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  padding: 7px 8px 7px 10px;
  border-radius: 8px;
  background: #edf4ee;
  color: #245c2c;
  font-weight: 800;
}

.access-pill button {
  min-height: 28px;
  border: 0;
  border-radius: 7px;
  background: #d8e8da;
  color: #245c2c;
  font-weight: 800;
}

.locked-task {
  padding: 16px;
  border: 1px solid #e4d5a5;
  border-radius: 8px;
  background: #fff8df;
  color: #7b6120;
  font-weight: 900;
  text-align: center;
}

.locked-label {
  color: #7b6120;
  background: #fff3c4;
}

.wide-empty {
  grid-column: 1 / -1;
}

.user-list {
  display: grid;
  gap: 10px;
}

.user-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.teacher-editor {
  display: grid;
  grid-column: 1 / -1;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.user-row strong,
.user-row span {
  display: block;
}

.user-row span {
  color: var(--muted);
  font-size: 14px;
}

.course-card,
.lesson-row,
.reader-card,
.inline-form,
.empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.course-card {
  display: grid;
  overflow: hidden;
}

.course-open {
  display: grid;
  gap: 12px;
  min-height: 260px;
  padding: 20px;
  border: 0;
  color: var(--ink);
  background:
    linear-gradient(var(--course-color), var(--course-color)) top / 100% 86px no-repeat,
    #fff;
  text-align: left;
}

.course-code {
  color: #fff;
  font-size: 34px;
  font-weight: 900;
}

.course-open strong {
  margin-top: 40px;
  font-size: 22px;
}

.course-open p,
.course-open small,
.lesson-open p,
.lesson-open small {
  color: var(--muted);
  line-height: 1.45;
}

.progress-line {
  overflow: hidden;
  width: 100%;
  height: 8px;
  border-radius: 99px;
  background: #e4e8e2;
}

.progress-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.course-card > .danger-button {
  margin: 0 16px 16px;
}

.lesson-row {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.lesson-open {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 0;
  background: transparent;
  text-align: left;
}

.lesson-open > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 900;
}

.lesson-shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: calc(100vh - 64px);
}

.lesson-side {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 22px 0;
  color: #fff;
  background: var(--dark);
}

.lesson-side > strong,
.lesson-side > .link-button {
  margin-inline: 18px;
}

.lesson-nav {
  display: grid;
  gap: 2px;
}

.lesson-nav-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
}

.lesson-nav-item {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 13px 18px 13px 26px;
  border: 0;
  border-left: 4px solid transparent;
  color: #eee;
  background: transparent;
  text-align: left;
}

.lesson-nav-delete {
  align-self: center;
  width: 32px;
  height: 32px;
  margin-right: 10px;
  border: 0;
  border-radius: 8px;
  opacity: 0;
  color: #fff;
  background: var(--danger);
  font-size: 22px;
  font-weight: 900;
  transition: opacity 0.15s ease;
}

.lesson-nav-row:hover .lesson-nav-delete,
.lesson-nav-delete:focus-visible {
  opacity: 1;
}

.lesson-nav-add {
  justify-self: stretch;
  min-height: 42px;
  margin: 12px 18px 0;
  border: 1px dashed #777;
  border-radius: 8px;
  opacity: 0.35;
  color: #e7e7e7;
  background: transparent;
  font-weight: 900;
  transition: opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.lesson-nav:hover .lesson-nav-add,
.lesson-nav-add:focus-visible,
.lesson-nav-add.visible {
  opacity: 1;
  border-color: #5cc86a;
  background: #2c2c2c;
}

.lesson-empty-note {
  margin: 16px 18px 0;
  color: #aaa;
  line-height: 1.45;
}

.empty-builder {
  display: grid;
  justify-items: start;
  gap: 12px;
  padding: 28px;
}

.empty-builder p {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.5;
}

.lesson-nav-item.active {
  border-left-color: #5cc86a;
  background: #3f7d45;
}

.lesson-nav-item span {
  color: #b9b9b9;
  font-size: 13px;
}

.lesson-nav-item .progress-line {
  height: 6px;
  background: #4a4a4a;
}

.lesson-main {
  background: #fff;
}

.lesson-step-bar {
  position: sticky;
  top: 64px;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: #f6f7f4;
}

.lesson-step-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.lesson-step-tab {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 6px;
  min-width: 92px;
  max-width: 160px;
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.lesson-step-tab.active {
  border-color: var(--accent);
  box-shadow: inset 0 -3px 0 var(--accent);
}

.lesson-step-tab span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: #fff;
  background: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.lesson-step-tab strong {
  font-size: 13px;
}

.lesson-step-tab small {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.add-block-wrap {
  position: relative;
}

.add-block-button {
  width: 44px;
  padding: 0;
  font-size: 24px;
}

.add-block-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 6px;
  width: 160px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.add-block-menu button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8faf7;
  font-weight: 900;
  text-align: left;
}

.reader-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 92px;
  padding: 20px 36px;
  border-bottom: 1px solid var(--line);
}

.reader-head h1 {
  font-size: 24px;
}

.reader-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.lesson-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #d6e6d8;
  border-radius: 999px;
  color: #173d1b;
  background: #f0f7f1;
  font-size: 13px;
  font-weight: 900;
}

.lesson-tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding-top: 14px;
  border-bottom: 1px solid var(--line);
}

.lesson-tab {
  min-height: 40px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #f3f4f2;
  font-weight: 900;
}

.lesson-tab.active {
  background: #fff;
  color: var(--accent);
}

.reader-body {
  display: grid;
  gap: 18px;
  max-width: 980px;
  margin: 0 auto;
  padding: 42px 30px 80px;
}

.reader-card,
.inline-form {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.task-edit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-edit-order {
  display: flex;
  gap: 6px;
}

.task-edit-order .ghost-button {
  min-height: 34px;
  padding: 0 10px;
}

.task-image-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8faf7;
}

.task-image-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.task-image-editor-head div {
  display: grid;
  gap: 3px;
}

.task-image-editor-head span {
  color: var(--muted);
  font-size: 14px;
}

.task-image-editor-grid,
.task-images {
  display: grid;
  gap: 12px;
}

.task-image-editor-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.task-image-frame,
.task-image-editor-card {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.task-image-frame img,
.task-image-editor-card img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #fff;
}

.task-image-frame figcaption,
.task-image-editor-card figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.task-image-editor-card .danger-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.task-image-editor-card[draggable="true"] {
  cursor: grab;
}

.task-image-editor-card.dragging {
  cursor: grabbing;
  opacity: 0.48;
}

.task-image-editor-card.drag-over {
  border-color: #3157d4;
  box-shadow:
    0 0 0 3px rgba(49, 87, 212, 0.14),
    0 16px 34px rgba(49, 87, 212, 0.16);
  transform: translateY(-2px);
}

.soft-empty {
  min-height: auto;
  padding: 12px;
  border-style: dashed;
  background: #fff;
}

.reader-card h2 {
  font-size: 28px;
  text-align: center;
}

.reader-card p {
  color: #2c302d;
  font-size: 18px;
  line-height: 1.65;
}

.theory-content {
  display: grid;
  gap: 14px;
}

.theory-content h2,
.theory-content h3,
.theory-content h4 {
  margin: 10px 0 0;
}

.theory-content p,
.rich-editor p {
  margin: 0;
}

.theory-content blockquote,
.rich-editor blockquote {
  margin: 0;
  padding: 12px 16px;
  border-left: 4px solid var(--accent);
  background: #f3f7f2;
}

.theory-content pre,
.rich-editor pre {
  overflow: auto;
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  background: #202522;
  color: #f6f8f5;
}

.theory-content a,
.rich-editor a {
  color: var(--accent-2);
  font-weight: 800;
}

.align-left {
  text-align: left;
}

.align-center {
  text-align: center;
}

.align-right {
  text-align: right;
}

.theory-content img,
.rich-editor img {
  display: block;
  max-width: min(100%, 680px);
  max-height: 420px;
  margin: 18px auto;
  border-radius: 8px;
  object-fit: contain;
}

.theory-content .theory-video,
.rich-editor .theory-video {
  display: grid;
  gap: 8px;
  width: min(100%, 820px);
  margin: 20px auto;
}

.theory-content video,
.rich-editor video {
  display: block;
  width: 100%;
  max-height: 520px;
  border-radius: 8px;
  background: #111827;
  box-shadow: 0 12px 28px rgba(18, 24, 20, 0.16);
}

.theory-content figcaption,
.rich-editor figcaption {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.rich-editor-wrap {
  display: grid;
  gap: 10px;
}

.editor-label {
  color: var(--muted);
  font-weight: 800;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f5f2;
}

.editor-toolbar button,
.editor-toolbar select {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-weight: 900;
}

.editor-toolbar select {
  width: auto;
}

.rich-editor {
  display: grid;
  gap: 12px;
  min-height: 300px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  line-height: 1.65;
  outline: 0;
}

.rich-editor:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 125, 67, 0.14);
}

.reader-label {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 6px;
  color: #24662d;
  background: #eaf7ec;
  font-size: 13px;
  font-weight: 900;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

input,
select {
  min-height: 42px;
  padding: 0 10px;
}

textarea {
  resize: vertical;
  padding: 10px;
  line-height: 1.45;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

/* Cleaner cabinet layout */
:root {
  --bg: #f7f8f6;
  --surface: #fff;
  --ink: #1f2420;
  --muted: #6e776f;
  --line: #e1e6df;
  --accent: #347b41;
  --accent-2: #456f95;
  --danger: #b65b69;
  --dark: #20231f;
}

body {
  background:
    linear-gradient(180deg, #fbfcfb 0, var(--bg) 280px),
    var(--bg);
}

.topbar {
  min-height: 58px;
  padding: 0 24px;
  border-bottom: 1px solid #30342f;
  box-shadow: none;
}

.brand {
  gap: 10px;
}

.brand span {
  color: #b9c0ba;
  font-size: 13px;
}

.role-tab,
.ghost-button,
.primary-button,
.secondary-button,
.danger-button,
.link-button {
  min-height: 38px;
  border-radius: 8px;
  font-size: 14px;
}

.page-head {
  max-width: 1180px;
  padding: 30px 28px 16px;
  align-items: center;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.05;
}

.page-head p {
  max-width: 640px;
}

.compact-head {
  padding-top: 20px;
  padding-bottom: 12px;
}

.compact-head h1 {
  font-size: 28px;
}

.eyebrow {
  margin-bottom: 7px;
  color: #50705a;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.home-tabs {
  max-width: 1180px;
  margin-bottom: 20px;
  gap: 6px;
}

.home-tab {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  box-shadow: none;
}

.home-tab.active {
  border-color: var(--dark);
  color: #fff;
  background: var(--dark);
}

.course-list,
.lesson-list,
.form-wrap,
.user-admin-grid,
.managed-students,
.student-management-workspace {
  max-width: 1180px;
}

.course-list {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  padding-bottom: 56px;
}

.course-card,
.lesson-row,
.reader-card,
.inline-form,
.empty,
.managed-student-list,
.managed-student-detail,
.student-access-card,
.access-panel,
.user-row,
.submission-summary,
.task-text,
.review-comment {
  border-color: var(--line);
  box-shadow: none;
}

.course-open {
  min-height: 220px;
  padding: 18px;
  background:
    linear-gradient(var(--course-color), var(--course-color)) top / 100% 70px no-repeat,
    #fff;
}

.course-code {
  font-size: 28px;
}

.course-open strong {
  margin-top: 26px;
  font-size: 20px;
  line-height: 1.15;
}

.course-open p,
.course-open small,
.lesson-open p,
.lesson-open small {
  font-size: 14px;
}

.user-admin-grid {
  grid-template-columns: minmax(300px, 0.85fr) minmax(0, 1.15fr);
}

.inline-form,
.reader-card,
.student-access-card,
.access-panel,
.managed-student-list,
.managed-student-detail {
  padding: 18px;
}

.student-management-workspace {
  grid-template-columns: 280px minmax(0, 1fr);
}

.calendar-page {
  max-width: 1280px;
}

.calendar-toolbar,
.calendar-sidebar,
.google-calendar {
  border-radius: 8px;
  box-shadow: none;
}

.calendar-toolbar {
  min-height: 78px;
  padding: 18px;
}

.calendar-toolbar h2 {
  font-size: 24px;
}

.reader-body {
  padding-top: 30px;
}

.reader-card h2 {
  font-size: 24px;
  text-align: left;
}

.reader-card p {
  font-size: 16px;
}

.homework-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px 56px;
}

.homework-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.homework-card h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.homework-card p {
  margin: 0;
  color: #343b36;
  line-height: 1.5;
}

.homework-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.homework-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  color: var(--muted);
  background: #f1f3f1;
  font-size: 13px;
  font-weight: 900;
}

.custom-homework-card {
  border-color: #d7e3ef;
  background: #f8fbff;
}

.homework-pending {
  border-color: #eadcae;
  background: #fffaf0;
}

.homework-pending .reader-label,
.homework-pending .homework-meta span {
  color: #7a5d1f;
  background: #fff4d8;
}

.homework-completed {
  border-color: #cfe3d2;
  background: #f6fbf7;
}

@media (max-width: 900px) {
  .topbar,
  .page-head,
  .reader-head {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .course-list {
    grid-template-columns: 1fr;
  }

  .user-admin-grid {
    grid-template-columns: 1fr;
  }

  .assignment-workbench {
    grid-template-columns: 1fr;
  }

  .student-management-workspace {
    grid-template-columns: 1fr;
  }

  .schedule-form,
  .calendar-layout,
  .month-week-head,
  .month-grid,
  .calendar-controls {
    grid-template-columns: 1fr;
  }

  .calendar-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .calendar-day-name,
  .calendar-slot,
  .calendar-hour-label {
    border-right: 0;
  }

  .calendar-slot,
  .calendar-hour-label {
    min-height: 150px;
  }

  .calendar-week-head,
  .calendar-week-grid {
    grid-template-columns: 48px repeat(var(--calendar-days, 7), minmax(0, 1fr));
  }

  .calendar-day-name {
    min-height: 64px;
    padding: 8px 2px;
  }

  .calendar-day-name span {
    font-size: 10px;
  }

  .calendar-day-name strong {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }

  .calendar-hour-label {
    padding: 8px 4px;
    font-size: 11px;
  }

  .calendar-slot-actions {
    width: 28px;
  }

  .calendar-slot-button {
    font-size: 9px;
  }

  .calendar-event {
    left: calc(4px + 12px * var(--event-column));
    width: calc(100% - 32px - (12px * (var(--event-columns) - 1)));
    padding: 6px;
    font-size: 10px;
  }

  .lesson-shell {
    grid-template-columns: 1fr;
  }

  .lesson-side {
    min-height: auto;
  }

  .lesson-step-bar {
    top: 0;
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .student-access-head,
  .assign-row,
  .access-student-row,
  .topic-task-row,
  .task-tree-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .task-row-actions {
    justify-content: start;
  }

  .answer-history-head {
    display: grid;
  }

  .submission-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .topbar {
    align-items: start;
    gap: 10px;
    padding: 12px 18px;
  }

  .topbar > .ghost-button {
    justify-self: start;
  }

  .session-box {
    flex-wrap: wrap;
  }

  .page-head {
    align-items: flex-start;
    padding: 26px 22px 14px;
  }

  .page-head > .primary-button {
    width: auto;
    max-width: 100%;
  }

  .home-tabs,
  .section-hint,
  .summary-cards,
  .course-list,
  .homework-page,
  .lesson-list,
  .form-wrap,
  .user-admin-grid,
  .managed-students,
  .student-management-workspace {
    padding-left: 22px;
    padding-right: 22px;
  }

  .home-tabs {
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .summary-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .summary-cards {
    grid-template-columns: 1fr;
  }
}

/* Compact schedule density */
.calendar-page {
  gap: 14px;
  padding-top: 0;
  padding-bottom: 48px;
}

.calendar-toolbar {
  min-height: 62px;
  padding: 12px 14px;
  gap: 14px;
}

.calendar-toolbar h2 {
  font-size: 21px;
}

.calendar-controls {
  grid-template-columns: auto 34px auto 34px minmax(184px, auto);
  gap: 7px;
}

.calendar-controls .ghost-button,
.calendar-view-switch button {
  min-height: 32px;
}

.calendar-view-switch button {
  padding: 0 10px;
}

.calendar-range {
  min-width: 190px;
  font-size: 13px;
}

.calendar-layout {
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
}

.calendar-sidebar {
  top: 70px;
  gap: 12px;
  padding: 14px;
}

.calendar-student-list {
  max-height: 240px;
}

.calendar-student {
  gap: 2px;
  padding: 9px 10px;
}

.calendar-week-head,
.calendar-week-grid {
  grid-template-columns: 54px repeat(var(--calendar-days, 7), minmax(0, 1fr));
}

.calendar-day-name {
  min-height: 56px;
  gap: 3px;
  padding: 8px 4px;
}

.calendar-day-name span {
  font-size: 10px;
}

.calendar-day-name strong {
  width: 30px;
  height: 30px;
  font-size: 15px;
}

.calendar-hour-label,
.calendar-slot {
  height: 64px;
  min-height: 64px;
}

.calendar-hour-label {
  padding: 6px 6px;
  font-size: 11px;
}

.calendar-slot-actions {
  top: 3px;
  right: 3px;
  bottom: 3px;
  width: 28px;
  gap: 2px;
}

.calendar-slot-button {
  border-radius: 5px;
  font-size: 9px;
}

.calendar-event {
  left: calc(4px + 14px * var(--event-column));
  width: calc(100% - 34px - (14px * (var(--event-columns) - 1)));
  min-height: 28px;
  height: max(28px, calc(var(--event-height) * 1% - 3px));
  gap: 2px;
  padding: 4px 6px;
  border-left-width: 3px;
  border-radius: 7px;
  font-size: 10px;
  line-height: 1.2;
}

.calendar-event.schedule-not-held,
.month-event.schedule-not-held,
.calendar-event.schedule-canceled,
.month-event.schedule-canceled {
  border-color: rgba(44, 100, 174, 0.22);
  border-left-color: #2f6fb3;
  background: linear-gradient(180deg, #eef6ff, #e1efff);
  color: #17456f;
}

.calendar-event.schedule-canceled .schedule-event-main,
.month-event.schedule-canceled .schedule-event-main {
  text-decoration: line-through;
}

.calendar-event.schedule-unpaid,
.month-event.schedule-unpaid {
  border-color: rgba(181, 133, 35, 0.26);
  border-left-color: #c08a25;
  background: linear-gradient(180deg, #fff8df, #f8edbd);
  color: #6d5117;
}

.calendar-event.schedule-paid,
.month-event.schedule-paid {
  border-color: rgba(61, 125, 67, 0.24);
  border-left-color: #3d7d43;
  background: linear-gradient(180deg, #eef9f0, #e3f3e6);
  color: #173f1f;
}

.calendar-event.open,
.month-event.open {
  background: #fff;
  color: var(--ink);
}

.schedule-event-main {
  gap: 2px;
}

.calendar-event.open {
  min-height: 96px;
}

.month-week-head div {
  padding: 9px;
}

.month-day {
  min-height: 118px;
  padding: 8px;
}

.month-event {
  padding: 5px 7px;
  font-size: 11px;
}

@media (max-width: 900px) {
  .calendar-page {
    padding-left: 18px;
    padding-right: 18px;
  }

  .calendar-layout {
    gap: 12px;
  }

  .calendar-toolbar {
    gap: 10px;
    padding: 12px;
  }

  .calendar-controls {
    grid-template-columns: repeat(4, max-content);
    justify-content: start;
  }

  .calendar-range {
    grid-column: 1 / -1;
    min-width: 0;
    text-align: left;
  }

  .calendar-week-head,
  .calendar-week-grid {
    grid-template-columns: 44px repeat(var(--calendar-days, 7), minmax(0, 1fr));
  }

  .calendar-hour-label,
  .calendar-slot {
    height: 72px;
    min-height: 72px;
  }

  .calendar-event {
    left: calc(3px + 10px * var(--event-column));
    width: calc(100% - 28px - (10px * (var(--event-columns) - 1)));
    padding: 4px;
    font-size: 9px;
  }
}

/* Brand palette: independent from Stepik */
:root {
  --bg: #f6f7fb;
  --surface: #fff;
  --ink: #1d2433;
  --muted: #697386;
  --line: #dfe4ee;
  --accent: #3f6fd8;
  --accent-2: #0e9f9a;
  --danger: #bf5268;
  --dark: #171b2a;
}

body {
  background:
    linear-gradient(180deg, #fbfcff 0, var(--bg) 320px),
    var(--bg);
}

.topbar {
  border-bottom-color: #252b3d;
  background: #171b2a;
}

.role-tab.active {
  background: linear-gradient(135deg, #3f6fd8, #12b6ad);
  color: #fff;
}

.brand span,
#userBadge {
  color: #c9d1e4;
}

.primary-button {
  background: #3f6fd8;
}

.secondary-button {
  background: #0e9f9a;
}

.link-button,
.eyebrow,
.theory-content a,
.rich-editor a {
  color: #315dc4;
}

.home-tab.active {
  border-color: #171b2a;
  background: #171b2a;
}

.reader-label,
.access-pill,
.schedule-status,
.schedule-payment-paid,
.grade-status-correct {
  color: #164f88;
  background: #eaf2ff;
}

.progress-line span {
  background: linear-gradient(90deg, #3f6fd8, #0e9f9a);
}

.course-open {
  background:
    linear-gradient(var(--course-color), var(--course-color)) top / 100% 70px no-repeat,
    #fff;
}

.calendar-view-switch {
  border-color: #dfe6f3;
  background: #eef3fb;
}

.calendar-view-switch button.active {
  color: #224a96;
}

.calendar-student.active {
  border-color: #88a7ea;
  background: linear-gradient(180deg, #f4f7ff, #e9f0ff);
  box-shadow: inset 4px 0 0 #3f6fd8, 0 10px 24px rgba(63, 111, 216, 0.12);
}

.calendar-day-name.today strong,
.calendar-slot-button:hover,
.calendar-slot-button:focus-visible {
  background: #3f6fd8;
  border-color: #3f6fd8;
}

.calendar-slot-button {
  color: #315dc4;
  border-color: #cfdaef;
}

.video-room-link {
  background: #315dc4;
  box-shadow: 0 8px 16px rgba(63, 111, 216, 0.2);
}

.month-day-head button {
  color: #315dc4;
  border-color: #cbd8f2;
  background: #eef4ff;
}

.calendar-event.schedule-paid,
.month-event.schedule-paid {
  border-color: rgba(14, 159, 154, 0.24);
  border-left-color: #0e9f9a;
  background: linear-gradient(180deg, #e9fbfa, #d9f5f3);
  color: #0b5652;
}

.calendar-event.open,
.month-event.open {
  background: #fff;
  color: var(--ink);
}

.rich-editor:focus {
  border-color: #3f6fd8;
  box-shadow: 0 0 0 3px rgba(63, 111, 216, 0.14);
}

.theory-content blockquote,
.rich-editor blockquote {
  border-left-color: #3f6fd8;
  background: #f1f5ff;
}

/* Modern product UI refresh */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-tint: #eef6ff;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e1ee;
  --line-soft: #e8edf5;
  --accent: #3157d4;
  --accent-strong: #243b9f;
  --accent-2: #0e9f9a;
  --accent-3: #f2a93b;
  --danger: #d1496b;
  --dark: #111827;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 8px 22px rgba(23, 32, 51, 0.06);
  --shadow-md: 0 18px 48px rgba(23, 32, 51, 0.1);
  --shadow-lg: 0 28px 80px rgba(23, 32, 51, 0.18);
}

html {
  background: var(--bg);
}

body {
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -12%, rgba(49, 87, 212, 0.14), transparent 34rem),
    radial-gradient(circle at 92% 0%, rgba(14, 159, 154, 0.12), transparent 30rem),
    linear-gradient(180deg, #fbfcff 0, #f5f7fb 360px, var(--bg) 100%);
  font-feature-settings: "cv02", "cv03", "cv04";
  text-rendering: optimizeLegibility;
}

::selection {
  color: #fff;
  background: var(--accent);
}

button,
input,
select,
textarea {
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.rich-editor:focus {
  outline: 0;
  border-color: rgba(49, 87, 212, 0.62);
  box-shadow: 0 0 0 4px rgba(49, 87, 212, 0.13);
}

.topbar {
  grid-template-columns: 1fr auto;
  min-height: 66px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(135deg, rgba(49, 87, 212, 0.24), transparent 48%),
    #111827;
  box-shadow: 0 12px 34px rgba(17, 24, 39, 0.18);
}

.brand strong {
  letter-spacing: 0;
}

.brand span,
#userBadge {
  color: #bcc7db;
}

.role-tab,
.ghost-button,
.primary-button,
.secondary-button,
.danger-button,
.link-button {
  min-height: 40px;
  border-radius: 10px;
  font-weight: 750;
}

.ghost-button,
.role-tab {
  border-color: rgba(255, 255, 255, 0.12);
  color: #eef2ff;
  background: rgba(255, 255, 255, 0.07);
}

.ghost-button:hover,
.role-tab:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.12);
}

.primary-button,
.secondary-button,
.danger-button,
.video-room-link {
  box-shadow: var(--shadow-sm);
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), #5978e8);
}

.primary-button:hover {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
}

.secondary-button {
  background: linear-gradient(135deg, var(--accent-2), #13b8ad);
}

.danger-button {
  background: linear-gradient(135deg, var(--danger), #e06a80);
}

.link-button {
  min-height: auto;
  color: var(--accent);
  text-decoration: none;
}

.auth-page {
  min-height: calc(100vh - 66px);
  background: transparent;
}

.auth-panel {
  gap: 16px;
  width: min(480px, 100%);
  padding: 34px;
  border: 1px solid rgba(217, 225, 238, 0.85);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

.auth-panel h1 {
  font-size: clamp(34px, 6vw, 48px);
  letter-spacing: 0;
}

.toast {
  border: 1px solid rgba(14, 159, 154, 0.22);
  border-radius: 14px;
  color: #0b5652;
  background: #ecfdfb;
  box-shadow: var(--shadow-lg);
}

.toast.error {
  border-color: rgba(209, 73, 107, 0.24);
  color: #8f2440;
  background: #fff1f4;
}

.page-head,
.home-tabs,
.section-hint,
.summary-cards,
.course-list,
.lesson-list,
.form-wrap,
.homework-page,
.user-admin-grid,
.managed-students,
.student-management-workspace {
  max-width: 1240px;
}

.page-head {
  padding: 36px 30px 18px;
}

.page-head h1 {
  color: #111827;
  font-size: clamp(32px, 4vw, 48px);
  letter-spacing: 0;
}

.page-head p {
  color: var(--muted);
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.home-tabs {
  gap: 8px;
  padding: 0 30px;
}

.home-tab {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(217, 225, 238, 0.95);
  border-radius: 12px;
  color: #506078;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.home-tab:hover {
  color: var(--accent);
  border-color: rgba(49, 87, 212, 0.22);
  background: #fff;
}

.home-tab strong {
  color: #40516f;
  background: #edf2fb;
}

.home-tab.active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #14a8a0);
  box-shadow: var(--shadow-sm);
}

.home-tab.active strong {
  color: #18305f;
  background: rgba(255, 255, 255, 0.86);
}

.section-hint {
  max-width: 1180px;
  margin-bottom: 16px;
  padding: 13px 16px;
  border: 1px solid rgba(49, 87, 212, 0.12);
  border-radius: 14px;
  color: #46566f;
  background: rgba(238, 246, 255, 0.72);
}

.summary-cards {
  gap: 14px;
  padding: 0 30px;
}

.summary-card {
  min-height: 112px;
  padding: 18px;
  border: 1px solid rgba(217, 225, 238, 0.9);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
  box-shadow: var(--shadow-sm);
}

.summary-card strong {
  color: #111827;
  font-size: 34px;
}

.summary-card span {
  color: #536178;
}

.course-list {
  gap: 18px;
  padding: 0 30px 64px;
}

.course-card,
.lesson-row,
.reader-card,
.inline-form,
.empty,
.managed-student-list,
.managed-student-detail,
.student-access-card,
.access-panel,
.user-row,
.submission-summary,
.task-text,
.review-comment,
.student-schedule-list,
.student-lesson-card,
.homework-card,
.calendar-toolbar,
.calendar-sidebar,
.google-calendar,
.schedule-modal,
.task-topic,
.topic-task-row,
.student-attempt-card,
.homework-task-picker,
.homework-task-preview,
.conduct-homework-block {
  border: 1px solid rgba(217, 225, 238, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-sm);
}

.course-card,
.lesson-row,
.homework-card,
.user-row,
.student-lesson-card {
  overflow: hidden;
}

.course-card:hover,
.lesson-row:hover,
.homework-card:hover,
.student-lesson-card:hover,
.user-row:hover {
  border-color: rgba(49, 87, 212, 0.22);
  box-shadow: var(--shadow-md);
}

.course-card > .danger-button {
  justify-self: end;
  width: auto;
  min-height: 36px;
  margin: 0 16px 16px;
  padding: 0 14px;
  border: 1px solid rgba(209, 73, 107, 0.24);
  color: #a62a48;
  background: #fff1f4;
  box-shadow: none;
}

.course-card > .danger-button:hover {
  color: #fff;
  background: var(--danger);
}

.course-open {
  min-height: 238px;
  padding: 20px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--course-color) 92%, #111827 8%), color-mix(in srgb, var(--course-color) 68%, #14b8a6 32%)) top / 100% 92px no-repeat,
    linear-gradient(180deg, #fff, #fbfcff);
}

.course-code {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 15px;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  font-size: 26px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.course-open strong {
  margin-top: 30px;
  color: #111827;
  font-size: 21px;
}

.progress-line {
  height: 8px;
  background: #e8edf5;
}

.progress-line span {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.lesson-row {
  padding: 16px;
}

.lesson-open {
  gap: 14px;
}

.lesson-open > span,
.task-topic header > span {
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #14a8a0);
}

.lesson-shell {
  grid-template-columns: 320px minmax(0, 1fr);
  background: #f6f8fc;
}

.lesson-side {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at 20% 0%, rgba(49, 87, 212, 0.24), transparent 22rem),
    linear-gradient(180deg, #111827, #172033);
}

.lesson-side > .link-button {
  color: #dbe7ff;
}

.lesson-nav {
  gap: 4px;
  padding-right: 12px;
}

.lesson-nav-item {
  margin-left: 10px;
  padding: 13px 14px;
  border-left: 0;
  border-radius: 0 14px 14px 0;
  color: #e7eefc;
}

.lesson-nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.lesson-nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(49, 87, 212, 0.9), rgba(14, 159, 154, 0.86));
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
}

.lesson-nav-item span {
  color: #bbc8df;
}

.lesson-nav-add {
  border-color: rgba(255, 255, 255, 0.26);
  border-radius: 12px;
}

.lesson-nav:hover .lesson-nav-add,
.lesson-nav-add:focus-visible,
.lesson-nav-add.visible {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.08);
}

.lesson-main {
  background: transparent;
}

.reader-head {
  min-height: 104px;
  padding: 24px 38px;
  border-bottom: 1px solid rgba(217, 225, 238, 0.88);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(14px);
}

.reader-head h1 {
  color: #111827;
  font-size: 28px;
}

.lesson-meta span,
.reader-label,
.access-pill,
.attempt-meta span,
.homework-meta span,
.schedule-status {
  border: 1px solid rgba(49, 87, 212, 0.12);
  border-radius: 999px;
  color: #24438e;
  background: #eef4ff;
}

.lesson-step-bar {
  top: 66px;
  padding: 12px 26px;
  border-bottom: 1px solid rgba(217, 225, 238, 0.9);
  background: rgba(246, 248, 252, 0.9);
  backdrop-filter: blur(14px);
}

.lesson-step-tab {
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 48px;
  min-width: 116px;
  max-width: 210px;
  padding: 7px 10px;
  border-color: rgba(217, 225, 238, 0.92);
  border-radius: 12px;
  background: #fff;
}

.lesson-step-tab:hover {
  border-color: rgba(49, 87, 212, 0.26);
}

.lesson-step-tab.active {
  border-color: rgba(49, 87, 212, 0.42);
  box-shadow: inset 0 -3px 0 var(--accent), var(--shadow-sm);
}

.lesson-step-tab span {
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #14a8a0);
}

.lesson-step-tab strong,
.lesson-step-tab small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.add-block-button {
  border-radius: 12px;
}

.add-block-menu {
  border-radius: 14px;
  box-shadow: var(--shadow-md);
}

.add-block-menu button {
  border-radius: 10px;
  background: var(--surface-soft);
}

.reader-body {
  max-width: 1040px;
  padding: 36px 32px 86px;
}

.reader-card,
.inline-form {
  gap: 18px;
  padding: 26px;
}

.reader-card h2 {
  color: #111827;
}

.reader-card p,
.theory-content,
.rich-editor {
  color: #273246;
}

.theory-content pre,
.rich-editor pre {
  border-radius: 14px;
  background: #111827;
}

.theory-content blockquote,
.rich-editor blockquote {
  border-left: 4px solid var(--accent);
  border-radius: 0 14px 14px 0;
  background: #f1f5ff;
}

.editor-toolbar {
  border-radius: 14px;
  background: #f4f7fb;
}

.editor-toolbar button,
.editor-toolbar select {
  border-radius: 10px;
}

.rich-editor {
  border-radius: 16px;
  background: #fff;
}

input,
select,
textarea {
  border-color: var(--line);
  border-radius: 12px;
  background: #fff;
}

input:hover,
select:hover,
textarea:hover,
.rich-editor:hover {
  border-color: #c8d3e4;
}

label {
  color: #536178;
}

.button-row {
  align-items: center;
}

.calendar-page {
  max-width: 1380px;
  gap: 16px;
  padding-left: 30px;
  padding-right: 30px;
}

.calendar-toolbar {
  min-height: 72px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}

.calendar-layout {
  grid-template-columns: 280px minmax(0, 1fr);
}

.calendar-sidebar {
  top: 82px;
}

.calendar-student {
  border-radius: 12px;
}

.calendar-student.active {
  border-color: rgba(49, 87, 212, 0.28);
  background: #eef4ff;
  box-shadow: inset 4px 0 0 var(--accent), var(--shadow-sm);
}

.google-calendar {
  overflow: hidden;
  background: #fff;
}

.calendar-day-name,
.calendar-time-head,
.calendar-hour-label {
  background: #f8fafc;
}

.calendar-day-name.today strong,
.calendar-slot-button:hover,
.calendar-slot-button:focus-visible {
  background: var(--accent);
}

.calendar-slot {
  background:
    linear-gradient(to bottom, transparent calc(25% - 1px), #eef2f8 calc(25% - 1px), #eef2f8 25%, transparent 25%),
    linear-gradient(to bottom, transparent calc(50% - 1px), #e7edf5 calc(50% - 1px), #e7edf5 50%, transparent 50%),
    linear-gradient(to bottom, transparent calc(75% - 1px), #eef2f8 calc(75% - 1px), #eef2f8 75%, transparent 75%),
    #fff;
}

.calendar-event,
.month-event {
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(23, 32, 51, 0.11);
}

.calendar-event.schedule-not-held,
.month-event.schedule-not-held,
.calendar-event.schedule-canceled,
.month-event.schedule-canceled {
  border-color: rgba(49, 87, 212, 0.22);
  border-left-color: var(--accent);
  background: linear-gradient(180deg, #edf4ff, #deebff);
  color: #1f438f;
}

.calendar-event.schedule-unpaid,
.month-event.schedule-unpaid {
  border-color: rgba(242, 169, 59, 0.3);
  border-left-color: var(--accent-3);
  background: linear-gradient(180deg, #fff8e8, #ffedbd);
  color: #75510f;
}

.calendar-event.schedule-paid,
.month-event.schedule-paid {
  border-color: rgba(14, 159, 154, 0.26);
  border-left-color: var(--accent-2);
  background: linear-gradient(180deg, #e9fbfa, #d8f4f2);
  color: #0b5652;
}

.calendar-event.open,
.month-event.open {
  border-color: rgba(23, 32, 51, 0.14);
  background: #fff;
  box-shadow: var(--shadow-lg);
}

.schedule-popover-actions .primary-button,
.schedule-popover-actions .video-room-link,
.schedule-popover-actions .schedule-delete-button {
  border-radius: 10px;
}

.schedule-delete-button {
  color: var(--danger);
}

.month-day {
  background: #fff;
}

.month-day.outside {
  background: #f7f9fc;
}

.homework-pending {
  border-color: rgba(242, 169, 59, 0.28);
  background: #fffaf0;
}

.homework-completed {
  border-color: rgba(14, 159, 154, 0.22);
  background: #f0fdfa;
}

.custom-homework-card {
  border-color: rgba(49, 87, 212, 0.18);
  background: #f8fbff;
}

.locked-task {
  border-color: rgba(242, 169, 59, 0.28);
  border-radius: 14px;
  background: #fff8e8;
}

.empty {
  color: #697386;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.92));
}

@media (max-width: 1100px) {
  .lesson-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .summary-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 14px 18px;
  }

  .session-box {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  #userBadge {
    width: 100%;
  }

  .page-head,
  .reader-head {
    padding-left: 22px;
    padding-right: 22px;
  }

  .home-tabs,
  .section-hint,
  .summary-cards,
  .course-list,
  .lesson-list,
  .form-wrap,
  .homework-page,
  .user-admin-grid,
  .managed-students,
  .student-management-workspace,
  .calendar-page {
    padding-left: 18px;
    padding-right: 18px;
  }

  .lesson-shell {
    grid-template-columns: 1fr;
  }

  .lesson-side {
    position: static;
    padding-bottom: 14px;
  }

  .lesson-step-bar {
    top: 0;
  }

  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .calendar-sidebar {
    position: static;
  }
}

@media (max-width: 640px) {
  .auth-panel {
    padding: 24px;
  }

  .summary-cards {
    grid-template-columns: 1fr;
  }

  .home-tab {
    min-width: max-content;
  }

  .reader-body {
    padding: 24px 18px 64px;
  }

  .reader-card,
  .inline-form {
    padding: 18px;
  }

  .calendar-week-head,
  .calendar-week-grid {
    grid-template-columns: 42px repeat(var(--calendar-days, 7), minmax(42px, 1fr));
  }
}

/* Premium workspace composition */
.workspace-hero {
  display: grid;
  gap: 18px;
  max-width: 1240px;
  margin: 30px auto 22px;
  padding: 24px;
  border: 1px solid rgba(217, 225, 238, 0.9);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(248, 251, 255, 0.88)),
    radial-gradient(circle at 82% 12%, rgba(49, 87, 212, 0.11), transparent 26rem);
  box-shadow: 0 24px 70px rgba(23, 32, 51, 0.11);
}

.workspace-hero-compact {
  gap: 16px;
  padding-top: 24px;
  padding-bottom: 22px;
}

.workspace-hero-compact .workspace-head h1 {
  font-size: clamp(28px, 3vw, 38px);
}

.workspace-hero-compact .workspace-head p:not(.eyebrow) {
  margin-top: 8px;
}

.workspace-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  gap: 24px;
  align-items: start;
}

.workspace-head h1 {
  margin: 0;
  color: #101828;
  font-size: clamp(30px, 3.45vw, 42px);
  line-height: 1.08;
  letter-spacing: 0;
  font-weight: 820;
}

.workspace-head p:not(.eyebrow) {
  max-width: 720px;
  margin: 12px 0 0;
  color: #5d6b82;
  font-size: 15px;
  line-height: 1.5;
}

.workspace-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 620px;
}

.workspace-actions > .link-button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid rgba(49, 87, 212, 0.14);
  border-radius: 12px;
  background: #f5f8ff;
}

.workspace-hero .home-tabs,
.workspace-hero .section-hint,
.workspace-hero .summary-cards {
  max-width: none;
  margin: 0;
  padding: 0;
}

.workspace-hero .home-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workspace-hero .section-hint {
  padding: 13px 15px;
  border-radius: 16px;
  background: rgba(238, 246, 255, 0.92);
  font-weight: 700;
}

.workspace-hero .summary-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.workspace-hero .summary-card {
  min-height: 96px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: none;
}

.workspace-hero .summary-card span,
.workspace-hero .summary-card small {
  font-weight: 700;
}

.workspace-hero .summary-card strong {
  font-weight: 820;
}

.workspace-hero + .course-list,
.workspace-hero + .lesson-list,
.workspace-hero + .assignment-workbench,
.workspace-hero + .calendar-page,
.workspace-hero + .user-admin-grid,
.workspace-hero + .student-management-workspace,
.workspace-hero + .managed-students,
.workspace-hero + .homework-page {
  padding-top: 0;
}

.course-list {
  align-items: stretch;
  grid-template-columns: repeat(auto-fill, minmax(320px, 390px));
  justify-content: start;
}

.course-card {
  border-radius: 22px;
  background: #fff;
}

.course-open {
  position: relative;
  align-content: start;
  min-height: 250px;
  padding: 22px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--course-color) 94%, #111827 6%), color-mix(in srgb, var(--course-color) 62%, #14b8a6 38%)) top / 100% 112px no-repeat,
    linear-gradient(180deg, #fff, #fbfcff);
}

.course-open::after {
  content: "";
  position: absolute;
  top: 18px;
  right: 18px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: -34px 18px 0 rgba(255, 255, 255, 0.08);
}

.course-code {
  position: relative;
  z-index: 1;
  width: 58px;
  height: 58px;
  border-radius: 18px;
}

.course-open strong {
  margin-top: 30px;
  font-size: 23px;
  line-height: 1.12;
  font-weight: 790;
}

.course-open p {
  min-height: 34px;
}

.course-card-action {
  margin-top: auto;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-top: 10px;
  padding: 0 12px;
  border-radius: 999px;
  color: #24438e;
  background: #eef4ff;
  font-size: 13px;
  font-weight: 900;
}

.lesson-list {
  gap: 12px;
}

.lesson-row {
  border-radius: 18px;
}

.lesson-open > div {
  display: grid;
  gap: 3px;
}

.lesson-open strong {
  color: #101828;
  font-size: 18px;
  font-weight: 760;
}

.inline-form,
.reader-card,
.student-access-card,
.access-panel,
.managed-student-list,
.managed-student-detail,
.user-row,
.task-topic,
.topic-task-row,
.homework-card {
  border-radius: 18px;
}

.assignment-workbench,
.student-management-workspace {
  max-width: 1240px;
}

.access-course-button,
.assigned-student-button,
.calendar-student {
  border-radius: 14px;
}

.access-course-button.active,
.assigned-student-button.active {
  border-color: rgba(49, 87, 212, 0.36);
  background: #eef4ff;
  box-shadow: inset 4px 0 0 var(--accent), var(--shadow-sm);
}

.calendar-page > .calendar-toolbar {
  margin-top: 0;
}

@media (max-width: 1100px) {
  .workspace-head {
    grid-template-columns: 1fr;
  }

  .workspace-actions {
    justify-content: flex-start;
    min-width: 0;
  }

  .workspace-hero .summary-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .workspace-hero {
    margin: 20px 18px 18px;
    padding: 18px;
  }
}

@media (max-width: 640px) {
  .workspace-head h1 {
    font-size: 34px;
  }

  .workspace-hero .summary-cards {
    grid-template-columns: 1fr;
  }

  .course-open {
    min-height: 260px;
  }
}

/* Inner work areas should support the hero, not compete with it */
.compact-head {
  max-width: 1240px;
  margin: 2px auto 8px;
  padding: 8px 30px 6px;
}

.compact-head h1 {
  font-size: clamp(24px, 2.6vw, 32px);
  line-height: 1.12;
  font-weight: 780;
}

.compact-head p {
  max-width: 680px;
  margin-top: 6px;
  font-size: 14px;
}

.compact-head .eyebrow {
  margin-bottom: 5px;
}

.workspace-hero + .page-head.compact-head {
  margin-top: 10px;
}

.managed-students,
.user-admin-grid,
.assignment-workbench,
.homework-page,
.lesson-list {
  padding-bottom: 72px;
}

.managed-student-list,
.managed-student-detail,
.assigned-student-list,
.student-task-tree,
.access-panel,
.user-row,
.inline-form {
  background: rgba(255, 255, 255, 0.98);
}

.managed-student-list,
.assigned-student-list,
.access-course-list,
.user-list {
  gap: 12px;
}

.managed-student-detail,
.student-task-tree {
  padding: 20px;
}

.student-access-card,
.access-panel {
  padding: 20px;
}

.task-tree-head,
.student-access-head {
  align-items: center;
}

.task-tree-head h2 {
  margin-top: 8px;
  font-size: 24px;
}

.topic-task-row {
  padding: 14px;
}

.topic-task-row > div:first-child {
  display: grid;
  gap: 5px;
}

.submission-card {
  gap: 16px;
  max-width: 1184px;
  padding: 26px;
}

.submission-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.submission-card h2 {
  margin-bottom: 0;
}

.submission-review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 14px;
}

.submission-panel,
.task-text.submission-panel,
.review-comment {
  display: grid;
  gap: 8px;
  min-height: 116px;
  padding: 16px;
  border: 1px solid rgba(203, 213, 225, 0.86);
  border-radius: 16px;
  background: #f8fbff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.submission-panel p,
.task-text.submission-panel p,
.review-comment p {
  margin: 0;
  color: #273449;
  line-height: 1.48;
}

.review-comment-field textarea {
  margin-top: 8px;
}

.submission-card .button-row {
  justify-content: flex-start;
}

.submission-summary,
.access-course-button,
.assigned-student-button,
.managed-student-button,
.calendar-student {
  min-height: 58px;
}

.user-row {
  padding: 18px;
}

.user-row > .danger-button,
.schedule-popover-actions .schedule-delete-button,
.topic-task-row .danger-button {
  box-shadow: none;
}

.account-settings .inline-form {
  max-width: 620px;
}

.password-editor {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  width: 100%;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.92);
}

.password-editor label {
  margin: 0;
}

@media (max-width: 900px) {
  .compact-head {
    padding-left: 18px;
    padding-right: 18px;
  }

  .submission-review-grid {
    grid-template-columns: 1fr;
  }

  .password-editor {
    grid-template-columns: 1fr;
  }
}

/* Course builder refinement */
.lesson-shell {
  min-height: calc(100vh - 66px);
  background:
    radial-gradient(circle at 12% 4%, rgba(50, 93, 224, 0.07), transparent 24rem),
    linear-gradient(180deg, #f8fbff 0%, #f3f6fb 100%);
}

.lesson-side {
  border-right: 1px solid rgba(203, 213, 225, 0.88);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 250, 255, 0.92));
  color: var(--ink);
  box-shadow: 12px 0 42px rgba(31, 42, 68, 0.06);
}

.lesson-side > strong {
  color: #111827;
  font-size: 17px;
  line-height: 1.25;
}

.lesson-side > .link-button {
  justify-content: flex-start;
  border-color: transparent;
  color: #3157d4;
  background: rgba(49, 87, 212, 0.08);
}

.lesson-nav {
  gap: 8px;
  padding: 8px 14px 18px;
}

.lesson-nav-row {
  border-radius: 16px;
}

.lesson-nav-item {
  margin-left: 0;
  padding: 14px 14px 14px 16px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: #334155;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 8px 22px rgba(31, 42, 68, 0.04);
}

.lesson-nav-item:hover {
  border-color: rgba(49, 87, 212, 0.16);
  background: #fff;
}

.lesson-nav-item.active {
  color: #111827;
  border-color: rgba(49, 87, 212, 0.18);
  background:
    linear-gradient(135deg, rgba(49, 87, 212, 0.12), rgba(14, 159, 154, 0.13)),
    #fff;
  box-shadow: 0 16px 34px rgba(49, 87, 212, 0.12);
}

.lesson-nav-item span,
.lesson-empty-note {
  color: #64748b;
}

.lesson-nav-delete {
  color: #be4b60;
  background: #fff1f3;
}

.lesson-nav-add {
  margin: 10px 0 0;
  color: #3157d4;
  border-color: rgba(49, 87, 212, 0.24);
  background: rgba(49, 87, 212, 0.06);
}

.lesson-nav:hover .lesson-nav-add,
.lesson-nav-add:focus-visible,
.lesson-nav-add.visible {
  border-color: rgba(49, 87, 212, 0.42);
  background: rgba(49, 87, 212, 0.1);
}

.lesson-main {
  background: transparent;
}

.reader-head {
  min-height: 118px;
  padding: 26px 38px 22px;
  border-bottom: 1px solid rgba(203, 213, 225, 0.76);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(248, 251, 255, 0.84));
  backdrop-filter: blur(14px);
}

.reader-head h1 {
  color: #111827;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.08;
}

.lesson-meta span {
  color: #31405b;
  border: 1px solid rgba(49, 87, 212, 0.14);
  border-radius: 999px;
  background: rgba(49, 87, 212, 0.07);
}

.lesson-step-bar {
  top: 66px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(203, 213, 225, 0.82);
  background: rgba(247, 250, 255, 0.92);
  backdrop-filter: blur(16px);
}

.lesson-step-tabs {
  gap: 10px;
  padding: 2px 0 4px;
}

.lesson-step-tab {
  min-width: 126px;
  min-height: 58px;
  padding: 10px 12px;
  border-color: rgba(203, 213, 225, 0.92);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 20px rgba(31, 42, 68, 0.05);
}

.lesson-step-tab.active {
  border-color: rgba(49, 87, 212, 0.42);
  background:
    linear-gradient(135deg, rgba(49, 87, 212, 0.08), rgba(14, 159, 154, 0.08)),
    #fff;
  box-shadow: 0 14px 34px rgba(49, 87, 212, 0.13);
}

.lesson-step-tab span {
  border-radius: 10px;
  background: linear-gradient(135deg, #3157d4, #0e9f9a);
}

.add-block-button {
  width: 46px;
  min-height: 46px;
  border-radius: 15px;
}

.add-block-menu {
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.add-block-menu button {
  border-radius: 12px;
  background: #f8fbff;
}

.lesson-row[draggable="true"],
.lesson-nav-row[draggable="true"],
.lesson-step-tab[draggable="true"] {
  cursor: grab;
}

.lesson-row.dragging,
.lesson-nav-row.dragging,
.lesson-step-tab.dragging {
  cursor: grabbing;
  opacity: 0.48;
}

.lesson-row.drag-over,
.lesson-nav-row.drag-over {
  outline: 2px solid rgba(49, 87, 212, 0.44);
  outline-offset: 3px;
  background: rgba(49, 87, 212, 0.08);
}

.lesson-step-tab {
  transition:
    border-color 0.12s ease,
    background 0.12s ease,
    box-shadow 0.12s ease,
    transform 0.12s ease;
}

.lesson-step-tab:hover {
  transform: translateY(-1px);
}

.lesson-step-tab.active {
  color: #0f172a;
  border-color: rgba(49, 87, 212, 0.7);
  background:
    linear-gradient(135deg, rgba(49, 87, 212, 0.16), rgba(14, 159, 154, 0.14)),
    #fff;
  box-shadow:
    0 16px 34px rgba(49, 87, 212, 0.17),
    inset 0 -4px 0 #3157d4;
}

.lesson-step-tab.drag-over {
  border-color: #0e9f9a;
  background: rgba(14, 159, 154, 0.12);
  box-shadow:
    0 0 0 3px rgba(14, 159, 154, 0.16),
    0 12px 26px rgba(14, 159, 154, 0.12);
}

.lesson-active-card {
  animation: step-card-in 0.14s ease-out;
}

.active-step-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -4px 0 18px;
  color: #64748b;
  font-size: 13px;
}

.active-step-label span,
.active-step-label strong {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(49, 87, 212, 0.08);
}

.active-step-label strong {
  color: #3157d4;
}

.active-step-label em {
  color: #0f172a;
  font-style: normal;
  font-weight: 800;
}

.lesson-title-editor {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(260px, 1.6fr) auto;
  align-items: end;
  gap: 14px;
  width: min(100%, 1040px);
}

.lesson-title-editor label {
  display: grid;
  gap: 6px;
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
}

.lesson-title-editor input,
.lesson-title-editor textarea {
  width: 100%;
  border: 1px solid rgba(203, 213, 225, 0.95);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: #111827;
  font: inherit;
  font-weight: 800;
}

.lesson-title-editor input {
  min-height: 46px;
  padding: 0 14px;
}

.lesson-title-editor textarea {
  min-height: 46px;
  padding: 10px 14px;
  resize: vertical;
}

@keyframes step-card-in {
  from {
    opacity: 0.72;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .lesson-step-bar {
    top: 0;
    padding-inline: 18px;
  }

  .reader-head {
    padding: 22px;
  }
}

/* Calendar polish: compact grid, readable events, bounded popovers. */
.calendar-page {
  max-width: 1540px;
}

.calendar-layout {
  align-items: start;
  grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
}

.google-calendar {
  overflow: hidden;
  border-color: #d9e3ee;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(37, 56, 88, 0.1);
}

.calendar-week-head,
.calendar-week-grid {
  grid-template-columns: 58px repeat(var(--calendar-days, 7), minmax(86px, 1fr));
}

.calendar-day-name {
  min-height: 58px;
  padding: 9px 6px;
  background: #fbfdff;
}

.calendar-day-name strong {
  width: 30px;
  height: 30px;
  font-size: 15px;
}

.calendar-hour-label,
.calendar-slot {
  height: 78px;
}

.calendar-hour-label {
  padding: 7px;
  color: #647276;
  background: #fbfdff;
  font-size: 12px;
}

.calendar-slot {
  background:
    linear-gradient(to bottom, transparent calc(25% - 1px), #edf2f6 calc(25% - 1px), #edf2f6 25%, transparent 25%),
    linear-gradient(to bottom, transparent calc(50% - 1px), #edf2f6 calc(50% - 1px), #edf2f6 50%, transparent 50%),
    linear-gradient(to bottom, transparent calc(75% - 1px), #edf2f6 calc(75% - 1px), #edf2f6 75%, transparent 75%),
    #fff;
}

.calendar-slot.today {
  background:
    linear-gradient(to bottom, transparent calc(25% - 1px), #e4ecff calc(25% - 1px), #e4ecff 25%, transparent 25%),
    linear-gradient(to bottom, transparent calc(50% - 1px), #e4ecff calc(50% - 1px), #e4ecff 50%, transparent 50%),
    linear-gradient(to bottom, transparent calc(75% - 1px), #e4ecff calc(75% - 1px), #e4ecff 75%, transparent 75%),
    #f7faff;
}

.calendar-slot-actions {
  inset: 4px 5px 4px auto;
  width: 38px;
  gap: 2px;
}

.calendar-slot-button {
  border-color: #cfe0ff;
  color: #2f5bc7;
  background: rgba(255, 255, 255, 0.96);
  font-size: 10px;
  box-shadow: 0 5px 14px rgba(47, 91, 199, 0.1);
}

.calendar-slot-button:hover,
.calendar-slot-button:focus-visible {
  border-color: #3f6fd8;
  background: #3f6fd8;
}

.calendar-event {
  left: calc(5px + ((100% - 10px) / var(--event-columns, 1)) * var(--event-column, 0));
  width: calc(((100% - 10px) / var(--event-columns, 1)) - 5px);
  min-height: 34px;
  height: max(34px, calc(var(--event-height) * 1% - 5px));
  padding: 6px 7px;
  border: 1px solid rgba(63, 111, 216, 0.24);
  border-left: 4px solid #3f6fd8;
  border-radius: 12px;
  background: linear-gradient(180deg, #eef4ff, #e4ecff);
  color: #183c91;
  line-height: 1.22;
  box-shadow: 0 8px 18px rgba(37, 56, 88, 0.12);
}

.calendar-event .schedule-event-main {
  min-width: 0;
}

.calendar-event strong {
  font-size: 12px;
}

.calendar-event span,
.calendar-event small {
  color: #49608f;
  font-size: 11px;
}

.calendar-event.open {
  z-index: 30;
  left: 6px;
  width: min(360px, calc(100vw - 48px));
  max-width: 360px;
  max-height: min(460px, calc(100vh - 160px));
  height: auto;
  padding: 12px;
  overflow: auto;
  border-color: #b7c9ff;
  border-left-width: 5px;
  background: #fff;
  box-shadow: 0 24px 58px rgba(37, 56, 88, 0.24);
}

.calendar-slot:nth-child(8n) .calendar-event.open,
.calendar-slot:nth-child(8n - 1) .calendar-event.open {
  right: 6px;
  left: auto;
}

.calendar-event.open .schedule-event-main {
  padding-right: 34px;
}

.schedule-detail-panel {
  gap: 8px;
  padding: 12px 0;
}

.schedule-detail-row {
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
}

.schedule-detail-row span,
.schedule-detail-row strong {
  font-size: 13px;
}

.schedule-popover-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.schedule-popover-actions .primary-button,
.schedule-popover-actions .video-room-link,
.schedule-popover-actions .schedule-delete-button {
  justify-content: center;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

.month-event.open {
  width: auto;
  max-width: none;
  max-height: 420px;
  overflow: auto;
}

/* FullCalendar integration */
.fullcalendar-shell {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.fullcalendar-host {
  overflow: hidden;
  border: 1px solid #d9e3ee;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(37, 56, 88, 0.1);
}

.fullcalendar-host .fc {
  color: #172033;
  font-family: inherit;
}

.fullcalendar-host .fc-theme-standard td,
.fullcalendar-host .fc-theme-standard th,
.fullcalendar-host .fc-scrollgrid {
  border-color: #e5ebf2;
}

.fullcalendar-host .fc-col-header-cell {
  background: #fbfdff;
}

.fullcalendar-host .fc-col-header-cell-cushion {
  padding: 12px 6px;
  color: #526173;
  font-weight: 900;
  text-decoration: none;
}

.fullcalendar-host .fc-timegrid-slot {
  height: 20px;
}

.fullcalendar-host .fc-timegrid-slot-label-cushion {
  color: #647276;
  font-size: 12px;
  font-weight: 900;
}

.fullcalendar-host .fc-timegrid-now-indicator-line {
  border-color: #e23b53;
}

.fullcalendar-host .fc-timegrid-now-indicator-arrow {
  border-color: #e23b53;
  border-top-color: transparent;
  border-bottom-color: transparent;
}

.fullcalendar-host .fc-day-today {
  background: #f7faff;
}

.fullcalendar-host .fc-event {
  overflow: hidden;
  border: 1px solid rgba(63, 111, 216, 0.28);
  border-left: 4px solid #3f6fd8;
  border-radius: 10px;
  background: linear-gradient(180deg, #eef4ff, #e4ecff);
  color: #183c91;
  box-shadow: 0 8px 18px rgba(37, 56, 88, 0.12);
}

.fullcalendar-host .fc-event.schedule-canceled {
  color: #23427a;
  text-decoration: line-through;
  border-color: rgba(63, 111, 216, 0.22);
  background: linear-gradient(180deg, #eef4ff, #dde8ff);
}

.fullcalendar-host .fc-event.schedule-unpaid {
  color: #6a4b00;
  border-color: rgba(216, 154, 0, 0.34);
  border-left-color: #d89a00;
  background: linear-gradient(180deg, #fff7d7, #ffefab);
}

.fullcalendar-host .fc-event.schedule-paid {
  color: #15542c;
  border-color: rgba(37, 143, 77, 0.28);
  border-left-color: #258f4d;
  background: linear-gradient(180deg, #eaf8ef, #d8f0df);
}

.fc-course-event {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 3px 4px;
  line-height: 1.2;
}

.fc-course-event strong,
.fc-course-event span,
.fc-course-event small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc-course-event strong {
  font-size: 12px;
  font-weight: 900;
}

.fc-course-event span {
  font-size: 12px;
  font-weight: 800;
}

.fc-course-event small {
  color: currentColor;
  opacity: 0.78;
  font-size: 11px;
}

.fullcalendar-host .fc-daygrid-day-number {
  color: #334155;
  font-weight: 900;
  text-decoration: none;
}

.fullcalendar-host .fc-daygrid-event {
  margin: 2px 5px;
}

.schedule-inspector {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid #cbd8ff;
  border-left: 5px solid #3f6fd8;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(37, 56, 88, 0.12);
}

.schedule-inspector-head {
  display: grid;
  gap: 4px;
  padding-right: 42px;
}

.schedule-inspector-head span {
  color: #3157d4;
  font-weight: 900;
}

.schedule-inspector-head h3 {
  margin: 0;
  color: #101828;
  font-size: 22px;
  line-height: 1.15;
}

.schedule-inspector.schedule-unpaid {
  border-color: #f0d27d;
  border-left-color: #d89a00;
}

.schedule-inspector.schedule-paid {
  border-color: #bfe5ca;
  border-left-color: #258f4d;
}

/* FullCalendar v2 polish: compact, bounded, usable. */
.calendar-page {
  max-width: 1500px;
}

.calendar-layout {
  align-items: start;
  grid-template-columns: minmax(210px, 250px) minmax(0, 1fr);
  gap: 18px;
}

.calendar-sidebar {
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  border-color: rgba(203, 213, 225, 0.84);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 42px rgba(37, 56, 88, 0.08);
}

.calendar-sidebar > strong {
  display: block;
  margin-bottom: 12px;
  color: #172033;
  font-size: 15px;
  font-weight: 950;
}

.calendar-student-list {
  gap: 9px;
}

.calendar-student {
  min-height: 62px;
  border-color: rgba(203, 213, 225, 0.8);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 8px 20px rgba(37, 56, 88, 0.05);
  transition: border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}

.calendar-student:hover {
  transform: translateY(-1px);
  border-color: rgba(63, 111, 216, 0.34);
  box-shadow: 0 14px 26px rgba(37, 56, 88, 0.1);
}

.calendar-student.active {
  border-color: rgba(63, 111, 216, 0.42);
  background: linear-gradient(135deg, rgba(63, 111, 216, 0.12), rgba(14, 159, 154, 0.08)), #fff;
  box-shadow: inset 4px 0 0 #3f6fd8, 0 14px 30px rgba(63, 111, 216, 0.14);
}

.calendar-help {
  margin-top: 14px;
  border-color: rgba(63, 111, 216, 0.16);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(63, 111, 216, 0.08), rgba(14, 159, 154, 0.06));
}

.calendar-toolbar {
  border-color: rgba(203, 213, 225, 0.82);
  border-radius: 20px;
  box-shadow: 0 16px 38px rgba(37, 56, 88, 0.08);
}

.calendar-controls {
  max-width: 100%;
}

.fullcalendar-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

.fullcalendar-shell.with-inspector {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  align-items: start;
}

.fullcalendar-card {
  position: relative;
  min-width: 0;
}

.fullcalendar-host {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, 0.86);
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  box-shadow: 0 22px 58px rgba(37, 56, 88, 0.12);
}

.calendar-empty-state {
  pointer-events: none;
  position: absolute;
  right: 22px;
  top: 88px;
  z-index: 3;
  display: grid;
  gap: 3px;
  max-width: min(360px, calc(100% - 44px));
  padding: 13px 15px;
  border: 1px solid rgba(203, 213, 225, 0.82);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 36px rgba(37, 56, 88, 0.12);
  backdrop-filter: blur(14px);
}

.calendar-empty-state strong {
  color: #172033;
  font-size: 14px;
  font-weight: 950;
}

.calendar-empty-state span {
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.fullcalendar-host .fc {
  --fc-border-color: #e7edf5;
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: #f8fbff;
  color: #172033;
  font-family: inherit;
}

.fullcalendar-host .fc-scrollgrid {
  border: 0;
}

.fullcalendar-host .fc-theme-standard td,
.fullcalendar-host .fc-theme-standard th {
  border-color: #e7edf5;
}

.fullcalendar-host .fc-scroller {
  scrollbar-color: #cbd7e8 transparent;
  scrollbar-width: thin;
}

.fullcalendar-host .fc-col-header-cell {
  background: linear-gradient(180deg, #fbfdff, #f6f9fe);
}

.fullcalendar-host .fc-col-header-cell-cushion {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 5px;
  color: #44546a;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  text-transform: lowercase;
}

.fullcalendar-host .fc-timegrid-axis,
.fullcalendar-host .fc-timegrid-slot-label {
  background: #fbfdff;
}

.fullcalendar-host .fc-timegrid-slot {
  height: 18px;
}

.fullcalendar-host .fc-timegrid-col,
.fullcalendar-host .fc-daygrid-day {
  cursor: crosshair;
}

.fullcalendar-host .fc-timegrid-col:hover {
  background:
    linear-gradient(90deg, rgba(63, 111, 216, 0.055), rgba(14, 159, 154, 0.045)),
    #fff;
}

.fullcalendar-host .fc-daygrid-day:hover {
  background: rgba(63, 111, 216, 0.065);
}

.fullcalendar-host .fc-highlight {
  border-radius: 10px;
  background: rgba(63, 111, 216, 0.18);
  box-shadow: inset 0 0 0 2px rgba(63, 111, 216, 0.24);
}

.fullcalendar-host .fc-timegrid-slot-minor {
  border-top-color: #f1f5f9;
}

.fullcalendar-host .fc-timegrid-slot-label-cushion {
  padding: 0 8px 0 10px;
  color: #6b7788;
  font-size: 12px;
  font-weight: 850;
}

.fullcalendar-host .fc-timegrid-col.fc-day-today {
  background: linear-gradient(180deg, rgba(63, 111, 216, 0.06), rgba(63, 111, 216, 0.025));
}

.fullcalendar-host .fc-daygrid-day.fc-day-today {
  background: rgba(63, 111, 216, 0.055);
}

.fullcalendar-host .fc-timegrid-now-indicator-line {
  border-color: #ef3b55;
  border-width: 2px;
}

.fullcalendar-host .fc-timegrid-now-indicator-arrow {
  border-color: #ef3b55;
  border-top-color: transparent;
  border-bottom-color: transparent;
}

.fullcalendar-host .fc-event {
  overflow: hidden;
  border: 1px solid rgba(63, 111, 216, 0.28);
  border-left: 4px solid #3f6fd8;
  border-radius: 11px;
  background: linear-gradient(180deg, #eef4ff, #e5edff);
  color: #183c91;
  box-shadow: 0 8px 18px rgba(37, 56, 88, 0.14);
}

.fullcalendar-host .fc-event-main {
  min-width: 0;
}

.fullcalendar-host .fc-timegrid-event {
  margin-inline: 3px;
}

.fullcalendar-host .fc-v-event .fc-event-main {
  color: inherit;
}

.fc-course-event {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 4px 5px;
  line-height: 1.16;
}

.fc-course-event strong,
.fc-course-event span,
.fc-course-event small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc-course-event strong {
  font-size: 12px;
  font-weight: 950;
}

.fc-course-event span {
  font-size: 12px;
  font-weight: 850;
}

.fc-course-event small {
  color: currentColor;
  opacity: 0.78;
  font-size: 10.5px;
}

.fullcalendar-host .fc-event.schedule-canceled {
  color: #274372;
  text-decoration: line-through;
  border-color: rgba(63, 111, 216, 0.2);
  border-left-color: #3f6fd8;
  background: linear-gradient(180deg, #eef4ff, #dde8ff);
}

.fullcalendar-host .fc-event.schedule-unpaid {
  color: #684800;
  border-color: rgba(216, 154, 0, 0.34);
  border-left-color: #d89a00;
  background: linear-gradient(180deg, #fff8df, #ffefa9);
}

.fullcalendar-host .fc-event.schedule-paid {
  color: #15542c;
  border-color: rgba(37, 143, 77, 0.28);
  border-left-color: #258f4d;
  background: linear-gradient(180deg, #eaf8ef, #d8f0df);
}

.fullcalendar-host .fc-daygrid-day-frame {
  min-height: 108px;
  padding: 2px;
}

.fullcalendar-host .fc-daygrid-day-number {
  color: #334155;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.fullcalendar-host .fc-daygrid-event {
  margin: 2px 5px;
}

.fullcalendar-host .fc-daygrid-more-link {
  color: #3157d4;
  font-size: 12px;
  font-weight: 900;
}

.schedule-inspector {
  position: sticky;
  top: 86px;
  max-height: min(680px, calc(100vh - 112px));
  overflow: auto;
  border-radius: 22px;
  box-shadow: 0 22px 58px rgba(37, 56, 88, 0.14);
}

.schedule-inspector-head h3 {
  font-size: 20px;
}

@media (max-width: 1180px) {
  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .calendar-sidebar {
    position: static;
    max-height: none;
  }

  .fullcalendar-shell.with-inspector {
    grid-template-columns: 1fr;
  }

  .schedule-inspector {
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .calendar-page {
    padding-inline: 14px;
  }

  .calendar-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .calendar-controls {
    grid-template-columns: 1fr;
  }

  .calendar-view-switch {
    width: 100%;
  }

  .calendar-view-switch button {
    flex: 1;
  }
}
