:root {
  --ink: #1f2933;
  --muted: #667085;
  --line: #d8dee6;
  --paper: #ffffff;
  --wash: #f4f7f9;
  --accent: #256f7b;
  --accent-strong: #174f5a;
  --green: #2f7d52;
  --amber: #a96318;
  --rose: #aa3d53;
  --shadow: 0 18px 50px rgba(31, 41, 51, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, #fbfcfd 0%, #f4f7f9 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  transition: grid-template-columns 180ms ease;
}

.app-shell:has(.sidebar.hidden) {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 84px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-height: 100vh;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: #fbfcfd;
  overflow: hidden;
}

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

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #256f7b, #2f7d52);
  font-weight: 800;
}

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

.brand span {
  color: var(--muted);
  font-size: 13px;
}

.brand-copy {
  min-width: 0;
}

.sidebar-toggle {
  display: grid;
  flex: 0 0 auto;
  width: 26px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-weight: 800;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
  color: var(--accent-strong);
  border-color: #bad6d9;
  outline: none;
}

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

.sidebar-groups {
  display: grid;
  gap: 8px;
  min-height: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.sidebar-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar-section-head strong {
  display: grid;
  min-width: 24px;
  min-height: 24px;
  place-items: center;
  border-radius: 999px;
  color: var(--accent-strong);
  background: #eaf5f6;
  font-size: 12px;
}

.sidebar .groups-list {
  max-height: min(38vh, 360px);
  overflow: auto;
  padding-right: 2px;
}

.pending-review-badge {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid #d8c79d;
  border-radius: 8px;
  padding: 8px 10px;
  color: #725000;
  background: #fffaf2;
  text-align: left;
}

.pending-review-badge span {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-review-badge strong {
  display: grid;
  min-width: 30px;
  min-height: 30px;
  place-items: center;
  border-radius: 999px;
  color: #725000;
  background: #ffe9c2;
  font-size: 14px;
}

.pending-review-badge-alert {
  border-color: #efbdc8;
  color: #8d2840;
  background: #fff1f4;
  box-shadow: 0 10px 24px rgba(170, 61, 83, 0.09);
}

.pending-review-badge-alert strong {
  color: #fff;
  background: var(--rose);
}

.sidebar-card {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #fff;
}

.sidebar-card p,
.sidebar-card strong,
.sidebar-card span {
  margin: 0;
}

.sidebar-card strong {
  overflow: hidden;
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-card span {
  color: var(--muted);
  font-size: 12px;
}

.sidebar-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.sidebar-card-actions .secondary-button {
  display: grid;
  min-height: 34px;
  place-items: center;
  padding: 0 8px;
  font-size: 12px;
  text-align: center;
  text-decoration: none;
}

.nav-item,
.ghost-button,
.secondary-button,
.primary-button,
.tab {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
}

.nav-item {
  text-align: left;
  color: var(--muted);
  background: transparent;
}

.nav-item.active,
.tab.active {
  color: var(--accent-strong);
  border-color: #bad6d9;
  background: #eaf5f6;
}

.session {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.sidebar-collapsed .sidebar {
  align-items: center;
  padding: 20px 14px;
}

.sidebar-collapsed .sidebar-head,
.sidebar-collapsed .nav,
.sidebar-collapsed .sidebar-groups,
.sidebar-collapsed .session {
  width: 100%;
}

.sidebar-collapsed .sidebar-head {
  justify-content: center;
}

.sidebar-collapsed .brand-copy,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .sidebar-section-head,
.sidebar-collapsed .groups-list,
.sidebar-collapsed .pending-review-badge,
.sidebar-collapsed .sidebar-card,
.sidebar-collapsed #sessionName,
.sidebar-collapsed .sidebar-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.sidebar-collapsed .brand {
  justify-content: center;
}

.sidebar-collapsed .brand-mark {
  width: 40px;
  height: 40px;
}

.sidebar-collapsed .sidebar-toggle,
.sidebar-collapsed .nav-item,
.sidebar-collapsed .ghost-button {
  min-width: 0;
  padding: 0;
  text-align: center;
}

.sidebar-collapsed .nav-item,
.sidebar-collapsed .ghost-button {
  display: grid;
  min-height: 56px;
  align-content: center;
  justify-items: center;
  gap: 3px;
}

.sidebar-collapsed .nav-item::before,
.sidebar-collapsed .ghost-button::before {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--accent);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.sidebar-collapsed .nav-item::after,
.sidebar-collapsed .ghost-button::after {
  max-width: 56px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-collapsed .nav-item.active::before {
  background: var(--accent-strong);
}

.sidebar-collapsed .nav-item.active::after {
  color: var(--accent-strong);
}

.sidebar-collapsed .nav-item[data-view="workspace"]::before {
  content: "⌂";
}

.sidebar-collapsed .nav-item[data-view="workspace"]::after {
  content: "Работа";
}

.sidebar-collapsed .nav-item[data-view="direct"]::before {
  content: "@";
}

.sidebar-collapsed .nav-item[data-view="direct"]::after {
  content: "Чаты";
}

.sidebar-collapsed .nav-item[data-view="admin"]::before {
  content: "⚙";
}

.sidebar-collapsed .nav-item[data-view="admin"]::after {
  content: "Админ";
}

.sidebar-collapsed .nav-item[data-view="notifications"]::before {
  content: "!";
}

.sidebar-collapsed .nav-item[data-view="notifications"]::after {
  content: "Увед.";
}

.sidebar-collapsed .ghost-button::before {
  content: "X";
  background: var(--rose);
}

.sidebar-collapsed .ghost-button::after {
  content: "Выйти";
}

.main {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  padding: 12px;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(380px, 0.9fr) minmax(360px, 0.72fr);
  align-items: stretch;
  width: min(1040px, 100%);
  min-height: min(680px, calc(100vh - 56px));
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 44px rgba(31, 41, 51, 0.06);
}

.auth-visual {
  position: relative;
  display: grid;
  align-content: center;
  gap: 28px;
  min-height: 560px;
  padding: 56px;
  border-right: 1px solid var(--line);
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(244, 250, 248, 0.94)),
    repeating-linear-gradient(0deg, rgba(37, 111, 123, 0.06) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(90deg, rgba(47, 125, 82, 0.05) 0 1px, transparent 1px 34px),
    #f8fbfa;
}

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

.auth-brand-row strong {
  font-size: 18px;
}

.auth-visual h1 {
  max-width: 520px;
  margin: 0;
  font-size: 48px;
  line-height: 1.05;
}

.auth-visual p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.auth-notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 620px;
}

.auth-notes div {
  display: grid;
  gap: 8px;
  min-width: 0;
  border: 1px solid rgba(216, 222, 230, 0.92);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.auth-notes span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.auth-notes strong {
  display: block;
}

.auth-notes p {
  font-size: 13px;
  line-height: 1.45;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(420px, 100%);
  justify-self: center;
  padding: 48px 42px;
}

.auth-panel-heading {
  margin-bottom: 22px;
}

.auth-panel-heading h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.18;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.tab {
  background: #fff;
  color: var(--muted);
}

.auth-panel .tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: #f7faf9;
}

.auth-panel .tab {
  min-width: 0;
  border-color: transparent;
  background: transparent;
}

.auth-panel .tab.active {
  border-color: #d6e8e9;
  background: #fff;
  box-shadow: 0 6px 16px rgba(31, 41, 51, 0.05);
}

.form-stack {
  display: grid;
  gap: 14px;
}

.form-stack label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  border-color: #78b6bd;
  outline: 3px solid rgba(37, 111, 123, 0.22);
  outline-offset: 2px;
}

.auth-panel input {
  min-height: 46px;
  background: #fbfcfd;
}

.auth-panel input:focus-visible {
  border-color: #78b6bd;
  outline: 3px solid rgba(37, 111, 123, 0.12);
}

.auth-panel .primary-button {
  min-height: 46px;
  margin-top: 4px;
}

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

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

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

.secondary-button,
.ghost-button {
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}

.workspace {
  display: grid;
  gap: 18px;
}

.topbar,
.hero-strip,
.pane-header,
.item-row,
.message-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h2,
.hero-strip h3,
.pane h3 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.view-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.pane,
.hero-strip,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.pane {
  padding: 18px;
}

.list-pane {
  min-height: 520px;
  padding: 14px;
}

.list,
.stack-list,
.progress-list {
  display: grid;
  gap: 10px;
}

.groups-list {
  gap: 6px;
}

.list-item,
.stack-item,
.progress-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fff;
}

.list-item {
  min-width: 0;
  text-align: left;
  overflow-wrap: anywhere;
}

.lesson-layout .list-item strong,
.lesson-layout .list-item span,
.lesson-detail .stack-item strong,
.lesson-detail .stack-item span {
  overflow-wrap: anywhere;
}

.group-list-item {
  min-height: 46px;
  padding: 9px 10px;
}

.group-list-item strong,
.group-list-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-list-item strong {
  margin-bottom: 2px;
  font-size: 14px;
  line-height: 1.2;
}

.group-list-item span {
  font-size: 12px;
}

.list-item.active {
  border-color: #78b6bd;
  background: #eef8f8;
}

.list-item strong,
.stack-item strong {
  display: block;
  margin-bottom: 4px;
}

.list-item span,
.stack-item span,
.metric-row span,
.progress-item span {
  color: var(--muted);
  font-size: 13px;
}

.progress-item {
  display: grid;
  gap: 12px;
  border-left-width: 4px;
}

.progress-risk-success {
  border-left-color: var(--green);
}

.progress-risk-warning {
  border-left-color: var(--amber);
}

.progress-risk-danger {
  border-left-color: var(--rose);
}

.progress-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(96px, 1fr));
  gap: 8px;
}

.progress-metrics div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fbfcfd;
}

.progress-metrics strong {
  display: block;
  margin: 0 0 2px;
  font-size: 18px;
}

.progress-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.panel-tools {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 220px);
  gap: 10px;
  margin-bottom: 14px;
}

.recommendations-list {
  margin-bottom: 14px;
}

.recommendation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.recommendation-item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.recommendation-item p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.recommendation-danger {
  border-left-color: var(--rose);
}

.recommendation-warning {
  border-left-color: var(--amber);
}

.recommendation-neutral {
  border-left-color: var(--accent);
}

.progress-next,
.assignment-progress-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.45fr) minmax(0, 1fr);
  gap: 10px;
}

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

.assignment-progress-row {
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.assignment-progress-row strong {
  overflow-wrap: anywhere;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
}

.status-success {
  background: var(--green);
}

.status-warning {
  background: var(--amber);
}

.status-danger {
  background: var(--rose);
}

.status-neutral {
  background: var(--muted);
}

.material-image {
  display: block;
  width: 100%;
  max-height: 340px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: var(--wash);
}

.material-main {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.material-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-strong);
  background: #eef8f8;
}

.material-icon svg,
.meeting-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.material-icon-text {
  color: #174f5a;
  background: #eaf5f6;
}

.material-icon-image {
  color: #2f7d52;
  background: #eff8f2;
}

.material-icon-file {
  color: #4f5f78;
  background: #f0f4fa;
}

.material-icon-video {
  color: #aa3d53;
  background: #fff0f3;
}

.material-icon-link {
  color: #8a5a14;
  background: #fff7e8;
}

.material-icon-interactive {
  color: #7c3aed;
  background: #f4f0ff;
}

.meeting-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border: 1px solid #efbdc8;
  border-radius: 8px;
  padding: 8px 14px 8px 10px;
  color: #8d2840;
  background: #fff1f4;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(170, 61, 83, 0.13);
}

.meeting-link:hover,
.meeting-link:focus-visible {
  border-color: #d86f84;
  color: #751d32;
  background: #ffe7ec;
}

.meeting-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--rose);
}

.meeting-icon svg {
  width: 27px;
  height: 27px;
  stroke-width: 2.2;
}

.meeting-link-empty {
  color: var(--muted);
  border-color: var(--line);
  background: #fbfcfd;
  box-shadow: none;
}

.meeting-link-empty .meeting-icon {
  background: var(--muted);
}

.content-area {
  min-width: 0;
}

.hero-strip {
  padding: 18px;
  margin-bottom: 14px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  gap: 10px;
}

.metric-row div {
  min-width: 88px;
  padding: 10px;
  border-radius: 8px;
  background: #f2f6f4;
}

.metric-row strong {
  display: block;
  color: var(--green);
  font-size: 20px;
}

.workspace-tabs {
  margin: 0 0 14px;
  flex-wrap: wrap;
  align-items: center;
}

.workspace-tabs .tab {
  flex: 1 1 120px;
  min-width: 0;
}

.panel-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -4px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: #fbfcfd;
}

.panel-context h3,
.panel-context p {
  margin: 0;
}

.panel-context p:not(.eyebrow) {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.context-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.workflow-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 12px;
  margin: -2px 0 14px;
  min-width: 0;
}

.workflow-card {
  flex: 1 1 180px;
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--paper);
  overflow-wrap: anywhere;
}

.workflow-card strong {
  font-size: 24px;
  line-height: 1.1;
}

.workflow-card p {
  min-height: 38px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  min-width: 0;
}

.workflow-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.workflow-card-danger {
  border-color: #efbdc8;
  background: #fff6f8;
}

.panel {
  padding: 16px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) 130px minmax(140px, 1fr) minmax(150px, 1fr) auto;
  gap: 10px;
  margin-bottom: 14px;
}

#materialForm,
#lessonMaterialForm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

#materialForm input,
#materialForm select,
#lessonMaterialForm input,
#lessonMaterialForm select,
#lessonMaterialForm textarea {
  flex: 1 1 160px;
  min-width: 0;
}

#lessonMaterialForm textarea[name="content"] {
  flex-basis: 100%;
  min-height: 110px;
  resize: vertical;
}

.material-text-content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#materialForm input[name="title"],
#lessonMaterialForm input[name="title"] {
  flex-basis: 240px;
}

#materialForm select[name="type"],
#lessonMaterialForm select[name="type"] {
  flex: 0 1 150px;
}

#materialForm input[type="file"],
#lessonMaterialForm input[type="file"] {
  flex-basis: 210px;
}

#materialForm button,
#lessonMaterialForm button {
  flex: 0 0 auto;
}

.form-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.form-error {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--rose);
  background: #fff1f2;
  font-size: 13px;
  line-height: 1.4;
}

.lesson-form {
  display: grid;
  grid-template-columns: 1fr 1fr 190px auto;
  gap: 10px;
  margin-bottom: 14px;
}

.lesson-form textarea {
  grid-column: 1 / -2;
  min-height: 74px;
}

.lesson-layout {
  display: grid;
  grid-template-columns: minmax(min(100%, 220px), 0.34fr) minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

#lessonsList {
  min-width: 0;
}

.learning-path {
  margin-bottom: 14px;
}

.learning-path-panel,
.recommendations-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.learning-path-panel h3,
.recommendations-panel h3,
.recommendation-item p {
  margin: 0;
}

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

.learning-path-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.learning-path-item strong,
.learning-path-item span {
  display: block;
  overflow-wrap: anywhere;
}

.learning-path-assignment {
  border-color: #d8c79d;
}

.path-step {
  display: flex;
  width: 30px;
  height: 30px;
  line-height: 30px;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 12px;
  font-weight: 800;
  justify-content: center;
  align-items: center;
  text-align: center;
}

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

.lesson-assignments-panel {
  display: grid;
  gap: 10px;
  border: 1px solid #d8c79d;
  border-radius: 8px;
  padding: 13px;
  background: #fffaf2;
}

.lesson-assignments-panel strong,
.lesson-assignment-item strong {
  display: block;
}

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

.lesson-assignment-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.lesson-assignment-item div {
  min-width: 0;
}

.lesson-assignment-item span {
  color: var(--muted);
  font-size: 13px;
}

.chat-list {
  display: grid;
  gap: 10px;
  min-height: 280px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.message {
  max-width: 78%;
  border-radius: 8px;
  padding: 10px 12px;
  background: #eef2f6;
}

.message.mine {
  justify-self: end;
  color: #fff;
  background: var(--accent);
}

.message small {
  display: block;
  margin-bottom: 4px;
  opacity: 0.78;
}

.message-form {
  margin-top: 14px;
}

.message-form input {
  flex: 1;
}

.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.board-toolbar span {
  color: var(--muted);
  font-size: 13px;
}

.board-canvas {
  position: relative;
  min-height: 560px;
  overflow: auto;
  border: 1px dashed #9eb8bd;
  border-radius: 8px;
  background:
    linear-gradient(#edf3f4 1px, transparent 1px),
    linear-gradient(90deg, #edf3f4 1px, transparent 1px),
    #fbfcfd;
  background-size: 28px 28px;
}

.compact-board {
  min-height: 360px;
}

.assignment-board {
  margin-top: 16px;
}

.board-canvas.drag-over {
  border-color: var(--accent);
  background-color: #edf8f8;
}

.board-canvas.drawing-mode {
  cursor: crosshair;
  border-color: var(--green);
  background-color: #f1faf5;
}

.board-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--muted);
  font-weight: 700;
}

.board-item {
  position: absolute;
  display: grid;
  gap: 8px;
  grid-template-rows: auto auto 1fr;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(31, 41, 51, 0.12);
  overflow: hidden;
  user-select: none;
  touch-action: none;
}

.board-item.dragging {
  z-index: 5;
  border-color: var(--accent);
}

.board-item.resizing {
  z-index: 6;
  border-color: var(--accent);
}

.board-item-note {
  background: #fff8d8;
}

.board-item-image,
.board-item-drawing {
  grid-template-rows: 1fr auto;
}

.board-item img {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 6px;
  object-fit: cover;
}

.drawing-svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: visible;
}

.temp-drawing {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 4;
}

.board-item p {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
  overflow: auto;
}

.board-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--rose);
  background: #fff;
}

.board-resize-controls {
  position: absolute;
  top: 6px;
  right: 38px;
  display: inline-flex;
  gap: 4px;
}

.board-resize-controls button {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent-strong);
  background: #fff;
  font-weight: 800;
  line-height: 1;
}

.board-resize-handle {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 5px 0 5px 0;
  background:
    linear-gradient(135deg, transparent 45%, #78b6bd 46%, #78b6bd 56%, transparent 57%),
    linear-gradient(135deg, transparent 62%, #78b6bd 63%, #78b6bd 73%, transparent 74%);
  cursor: nwse-resize;
  opacity: 0.82;
}

.board-resize-handle:hover,
.board-resize-handle:focus-visible {
  background:
    linear-gradient(135deg, transparent 45%, var(--accent-strong) 46%, var(--accent-strong) 56%, transparent 57%),
    linear-gradient(135deg, transparent 62%, var(--accent-strong) 63%, var(--accent-strong) 73%, transparent 74%);
  opacity: 1;
}

.board-edit {
  justify-self: start;
  min-height: 28px;
  border: 1px solid #e2c867;
  border-radius: 8px;
  padding: 0 9px;
  color: #725000;
  background: #fff9d7;
  font-size: 12px;
}

.board-edit-form {
  display: grid;
  gap: 4px;
}

.board-edit-form span {
  color: var(--muted);
  font-size: 12px;
}

.board-edit-form textarea {
  min-height: 88px;
}

.board-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 18px;
}

.direct-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(260px, 0.9fr) minmax(360px, 1.4fr);
  gap: 18px;
}

.direct-thread-pane {
  min-height: 560px;
}

.accounts-pane {
  grid-column: 1 / -1;
}

.item-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.assignment-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

.assignment-tools select {
  max-width: 260px;
}

.question-bank-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.json-test-import {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
}

.json-test-import input {
  max-width: 190px;
}

.passing-score-field {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
}

.question-bank-tools select {
  max-width: 220px;
}

.assignment-builder,
.assignment-submit-form,
.assignment-preview,
.submission-answers,
.question-grade-list,
.rubric-panel,
.graded-review,
.review-summary,
.review-queue-list,
.submission-result {
  display: grid;
  gap: 10px;
}

.graded-review {
  margin-top: 6px;
}

.graded-review-row {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.graded-review-miss {
  border-color: #efbdc8;
  background: #fff7f8;
}

.rubric-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.rubric-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.review-queue {
  margin-bottom: 14px;
}

.review-queue-panel {
  display: grid;
  gap: 12px;
  border: 1px solid #e6c391;
  border-radius: 8px;
  padding: 14px;
  background: #fffaf2;
}

.review-queue-panel h3,
.review-queue-panel p {
  margin: 0;
}

.review-queue-empty {
  border-color: #b7d8c5;
  background: #f4fbf7;
}

.review-queue-empty p:not(.eyebrow) {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.review-queue-list {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.review-queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.review-queue-item div {
  min-width: 0;
}

.review-queue-item strong,
.review-queue-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-queue-item span {
  color: var(--muted);
  font-size: 13px;
}

.assignment-card {
  border-left-width: 4px;
}

.assignment-success {
  border-left-color: var(--green);
}

.assignment-warning {
  border-left-color: var(--amber);
}

.assignment-danger {
  border-left-color: var(--rose);
}

.assignment-neutral {
  border-left-color: var(--accent);
}

.assignment-empty {
  display: grid;
  gap: 4px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.review-summary {
  grid-template-columns: auto 1fr;
  align-items: center;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
}

.submission-card {
  margin-top: 10px;
  background: #fbfcfd;
}

.submission-sender {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.submission-sender span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.submission-sender strong,
.submission-sender small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.submission-sender small {
  color: var(--muted);
  font-size: 12px;
}

.submission-pending {
  border-color: #e6c391;
}

.submission-graded {
  border-color: #b7d8c5;
}

.submission-focus {
  outline: 3px solid rgba(37, 111, 123, 0.26);
  outline-offset: 2px;
}

.assignment-builder,
.assignment-interactive-fields,
.assignment-submit-form {
  grid-column: 1 / -1;
}

.assignment-interactive-fields {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 10px;
}

.question-builder-item label,
.assignment-question {
  display: grid;
  gap: 7px;
}

.assignment-question {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: auto;
  min-height: auto;
}

.question-grade-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.question-grade-row-range {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 280px);
}

.range-grade {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 42px;
  align-items: center;
  gap: 8px;
}

.range-grade input {
  width: 100%;
  min-height: 28px;
  padding: 0;
}

.range-grade output {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.interactive-grade-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 42px minmax(180px, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.interactive-grade-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.interactive-grade-row input[type="range"] {
  min-height: 30px;
  padding: 0;
}

.interactive-grade-row output {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  padding-bottom: 10px;
}

.segmented-grade {
  display: inline-flex;
  gap: 4px;
}

.segmented-grade button {
  min-width: 46px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.segmented-grade button.active {
  border-color: #78b6bd;
  color: var(--accent-strong);
  background: #eaf5f6;
  font-weight: 800;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--accent-strong);
  background: #eaf5f6;
  font-size: 12px;
  font-weight: 700;
}

.pill-danger {
  color: var(--rose);
  background: #fff0f3;
}

.danger-text {
  color: var(--rose);
}

.loading-state {
  color: var(--muted);
  background: repeating-linear-gradient(
    135deg,
    #f8fafc,
    #f8fafc 10px,
    #eef2f7 10px,
    #eef2f7 20px
  );
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  border-radius: 8px;
  padding: 13px 16px;
  color: #fff;
  background: #1f2933;
  box-shadow: var(--shadow);
}

.toast-success {
  background: var(--green);
}

.interactive-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  padding: 16px;
  background: rgba(31, 41, 51, 0.72);
}

.interactive-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  border-radius: 8px;
  background: #f8fafc;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.32);
  overflow: hidden;
}

.interactive-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px;
  background: #fff;
}

.interactive-toolbar p,
.interactive-toolbar strong {
  margin: 0;
}

.interactive-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.interactive-actions .secondary-button,
.interactive-actions .primary-button {
  min-height: 34px;
  padding: 0 10px;
}

.interactive-actions input[type="color"] {
  width: 42px;
  min-height: 34px;
  padding: 4px;
}

.interactive-actions input[type="range"] {
  width: 96px;
  min-height: 34px;
  padding: 0;
}

#interactiveStatus {
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  background: #fbfcfd;
}

.interactive-stage {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

.interactive-page {
  position: relative;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 16px 44px rgba(31, 41, 51, 0.2);
}

.interactive-page canvas {
  position: absolute;
  inset: 0;
  display: block;
}

#interactiveDrawCanvas {
  z-index: 2;
  cursor: crosshair;
  touch-action: none;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .app-shell,
  .auth-layout,
  .view-grid,
  .admin-grid,
  .direct-layout {
    grid-template-columns: 1fr;
  }

  .auth-layout {
    width: 100%;
    min-height: auto;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 3;
  }

  .auth-visual {
    min-height: auto;
    padding: 38px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .auth-visual h1 {
    font-size: 40px;
  }

  .auth-panel {
    width: min(520px, 100%);
    padding: 34px;
  }

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

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

  .panel-context {
    align-items: stretch;
    flex-direction: column;
  }

  .context-actions {
    justify-content: flex-start;
  }

  .assignment-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .assignment-tools select {
    max-width: none;
  }

  .question-bank-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .question-bank-tools select {
    max-width: none;
  }

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

  .progress-metrics {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .lesson-form,
  .lesson-layout {
    grid-template-columns: 1fr;
  }

  .lesson-form textarea {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .main,
  .sidebar,
  .auth-panel,
  .auth-visual {
    padding: 8px;
  }

  .auth-layout {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .auth-visual {
    gap: 18px;
  }

  .auth-visual h1 {
    font-size: 32px;
  }

  .auth-visual p {
    font-size: 15px;
  }

  .auth-notes {
    grid-template-columns: 1fr;
  }

  .auth-notes div {
    padding: 12px;
  }

  .auth-panel-heading h2 {
    font-size: 24px;
  }

  .topbar,
  .hero-strip,
  .pane-header,
  .message-form {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-row {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .progress-metrics,
  .progress-next,
  .assignment-progress-row,
  .rubric-row {
    grid-template-columns: 1fr;
  }

  .status-dot {
    display: none;
  }

  .message {
    max-width: 100%;
  }
}
