:root {
  --bg: #f4f7f7;
  --panel: #ffffff;
  --line: #d9e2e3;
  --text: #1f2d36;
  --muted: #61727c;
  --primary: #1d6f73;
  --primary-strong: #15565a;
  --secondary: #edf5f5;
  --accent: #f3c96b;
  --danger: #b64646;
  --shadow: 0 10px 28px rgba(25, 55, 65, 0.09);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.public-security-filing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #5f7480;
  font-size: 14px;
  text-decoration: none;
}

.public-security-filing:hover {
  color: #176d72;
  text-decoration: underline;
}

.public-security-filing img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.topbar {
  min-height: 84px;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #d8f1ef;
  border-bottom: 1px solid #b9dedd;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

main {
  padding: 24px;
}

.hidden {
  display: none !important;
}

.auth-layout {
  max-width: 520px;
  margin: 42px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.auth-panel,
.main-panel,
.sidebar,
.chat-panel,
.task-panel,
.score-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.auth-panel {
  padding: 28px;
}

.auth-panel h2,
.section-title h2,
.empty-state h2,
.attempt-header h2 {
  margin: 0;
}

.auth-copy {
  margin: 10px 0 2px;
  color: var(--muted);
  line-height: 1.6;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.auth-actions .primary,
.auth-actions .secondary {
  width: 100%;
  margin-top: 0;
}

label {
  display: block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

input,
textarea,
select {
  width: 100%;
  margin-top: 6px;
  padding: 10px 11px;
  border: 1px solid #c9d5d7;
  background: #fbfdfd;
  color: var(--text);
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 111, 115, 0.12);
}

.primary,
.secondary,
.ghost,
.small {
  min-height: 38px;
  padding: 0 15px;
  border-radius: 6px;
}

.primary {
  margin-top: 18px;
  background: var(--primary);
  color: #fff;
}

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

.secondary {
  margin-top: 18px;
  background: var(--secondary);
  color: var(--primary-strong);
  border: 1px solid #b8d8d8;
}

.secondary.active {
  background: #fff0cf;
  border-color: #d9b456;
  color: #684b00;
  font-weight: 700;
}

.ghost {
  background: transparent;
  color: var(--primary-strong);
  border: 1px solid #9fc8c7;
}

.small {
  min-height: 32px;
  padding: 0 10px;
  background: #eef6f6;
  border: 1px solid #c7dada;
  color: var(--primary-strong);
}

.full {
  width: 100%;
}

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

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

.sidebar,
.main-panel {
  min-height: calc(100vh - 132px);
}

.sidebar {
  padding: 16px;
}

.main-panel {
  padding: 18px;
}

.section-title,
.attempt-header,
.chat-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.case-list,
.attempt-list {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.system-tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.system-tabs button {
  min-height: 42px;
  padding: 0 12px;
  text-align: left;
  border: 1px solid #c7dada;
  background: #f7fbfb;
  color: var(--primary-strong);
  border-radius: 6px;
}

.system-tabs button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 700;
}

.disease-list {
  display: grid;
  gap: 12px;
}

.case-card,
.attempt-card {
  padding: 14px;
  border: 1px solid var(--line);
  background: #fbfdfd;
}

.case-thumb {
  margin: -4px -4px 12px;
  height: 118px;
  overflow: hidden;
  border: 1px solid #d6e4e5;
  background: #edf5f5;
}

.case-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.case-card-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.mini-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d8f1ef;
  border: 1px solid #a9d3d2;
  color: var(--primary-strong);
  font-weight: 700;
}

.case-card h3,
.attempt-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.case-card p,
.attempt-card p,
.empty-state p,
.attempt-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.case-card ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.case-scene {
  margin-top: 8px !important;
  padding: 8px 10px;
  background: #eef6f6;
  border-left: 3px solid var(--primary);
}

.case-card button {
  width: 100%;
}

.empty-state {
  padding: 70px 24px;
  text-align: center;
}

.two-column {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 0.95fr);
  gap: 18px;
}

.scene-card {
  margin-top: 16px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #cbdcdd;
  background: #edf5f5;
}

.scene-card img {
  width: 100%;
  height: clamp(180px, 24vw, 300px);
  display: block;
  object-fit: cover;
}

.chat-panel,
.task-panel,
.score-panel {
  padding: 16px;
  box-shadow: none;
}

.chat-panel h3,
.task-panel h3,
.score-panel h3 {
  margin: 0 0 12px;
}

.messages {
  height: 470px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  background: #f7fbfb;
}

.message {
  max-width: 86%;
  margin-bottom: 12px;
  padding: 10px 12px;
  line-height: 1.55;
  border: 1px solid var(--line);
  background: #fff;
  white-space: pre-wrap;
}

.message.patient {
  margin-right: auto;
  border-left: 4px solid var(--primary);
}

.message.student {
  margin-left: auto;
  background: #eef6f6;
  border-right: 4px solid var(--accent);
}

.message small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
}

.chat-input {
  margin-top: 12px;
}

.speak-toggle {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.speak-toggle input {
  width: auto;
  margin: 0;
}

.score-panel {
  margin-top: 18px;
}

.score-summary {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px;
  border: 1px solid #d9d0a2;
  background: #fff9e8;
}

.score-number {
  font-size: 34px;
  font-weight: 700;
  color: var(--primary-strong);
}

.score-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.score-item {
  padding: 12px;
  border: 1px solid var(--line);
  background: #fbfdfd;
}

.score-item strong {
  display: block;
  margin-bottom: 6px;
}

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

.export-link {
  display: block;
  margin-top: 14px;
  color: var(--primary-strong);
  text-decoration: none;
}

.detail-block {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fbfdfd;
}

.detail-block h3 {
  margin: 0 0 10px;
}

.detail-block pre {
  white-space: pre-wrap;
  line-height: 1.55;
  margin: 0;
  font-family: inherit;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 12px 14px;
  background: #22353d;
  color: #fff;
  box-shadow: var(--shadow);
  border-radius: 6px;
  line-height: 1.45;
}

.toast.error {
  background: var(--danger);
}

@media (max-width: 980px) {
  .workspace,
  .two-column,
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .main-panel {
    min-height: auto;
  }

  .score-grid {
    grid-template-columns: 1fr;
  }

  .scene-card img {
    height: 180px;
  }
}

@media (max-width: 640px) {
  main {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .messages {
    height: 360px;
  }
}

/* Role-based sign-in */
.role-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  margin-bottom: 24px;
  padding: 3px;
  border: 1px solid #c5d4d6;
  background: #eef3f3;
  border-radius: 6px;
}

.role-switch button {
  min-height: 42px;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  border-radius: 4px;
}

.role-switch button.active {
  background: #fff;
  color: var(--primary-strong);
  box-shadow: 0 1px 4px rgba(25, 55, 65, 0.12);
  font-weight: 700;
}

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

/* Case library */
.system-tree {
  display: grid;
  gap: 7px;
}

.system-group {
  border: 1px solid #cfdcdd;
  background: #fff;
}

.system-button {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  background: #f7fafa;
  color: var(--text);
}

.system-group.expanded .system-button {
  background: #e5f2f1;
  color: var(--primary-strong);
  font-weight: 700;
  border-bottom: 1px solid #cfdcdd;
}

.system-count {
  min-width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid #c7dada;
  border-radius: 50%;
  font-size: 12px;
}

.disease-tree {
  padding: 6px;
  display: grid;
  gap: 4px;
}

.disease-button {
  width: 100%;
  min-height: 40px;
  padding: 7px 10px 7px 18px;
  text-align: left;
  background: transparent;
  color: var(--muted);
  border-left: 3px solid transparent;
}

.disease-button span,
.disease-button small {
  display: block;
}

.disease-button small {
  margin-top: 3px;
  color: #7a8a92;
  font-size: 11px;
}

.disease-button:hover {
  background: #f4f8f8;
  color: var(--text);
}

.disease-button.active {
  background: #fff7e4;
  border-left-color: #d5a93f;
  color: #5f4814;
  font-weight: 700;
}

.student-welcome {
  min-height: calc(100vh - 210px);
  display: grid;
  align-content: center;
  width: 100%;
  max-width: 900px;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 48px 30px;
  text-align: center;
}

.student-welcome h2 {
  max-width: 620px;
  margin: 0 auto;
  font-size: 34px;
  line-height: 1.3;
  letter-spacing: 0;
}

.welcome-task-note {
  margin: 24px auto 0;
  padding: 11px 15px;
  border: 1px solid #e0cf9e;
  background: #fff8e8;
  color: #6e571b;
  font-size: 14px;
}

.student-task-empty {
  padding: 24px 12px;
  border: 1px dashed #bfcfd1;
  background: #f8fbfb;
  text-align: center;
}

.student-task-empty strong,
.student-task-empty span {
  display: block;
}

.student-task-empty span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.welcome-lead {
  max-width: none;
  margin: 22px auto 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.9;
  white-space: nowrap;
}

.welcome-values {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 32px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.welcome-values span {
  padding: 14px 10px;
  color: var(--text);
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}

.welcome-values span + span {
  border-left: 1px solid var(--line);
}

.case-overview {
  min-height: calc(100vh - 170px);
}

.case-hero {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 500px;
  overflow: hidden;
  border: 1px solid #cbd8da;
  background: #e9efef;
}

.case-hero img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.case-overview-body {
  padding: 22px 4px 4px;
}

.case-overview-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.case-overview-heading h3 {
  margin: 0;
  font-size: 26px;
}

.case-overview-heading p {
  margin: 7px 0 0;
  color: var(--muted);
}

.patient-chip {
  flex: 0 0 auto;
  padding: 7px 10px;
  background: #eef6f6;
  border: 1px solid #c5dada;
  border-radius: 6px;
  color: var(--primary-strong);
  font-size: 14px;
}

.overview-chips {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.overview-section {
  padding: 18px 0 0;
}

.overview-section h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.patient-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 12px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.patient-info-grid > div {
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f8fbfb;
}

.patient-info-grid span,
.patient-info-grid strong {
  display: block;
}

.patient-info-grid span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.patient-info-grid strong {
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 600;
}

.overview-section p,
.goal-list {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.goal-list {
  padding-left: 22px;
}

.goal-list li + li {
  margin-top: 5px;
}

.case-start-bar {
  margin-top: 22px;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  border: 1px solid #cfdcdd;
  background: #f5f9f9;
}

.case-start-bar strong,
.case-start-bar span {
  display: block;
}

.case-start-bar span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.case-start-bar .primary,
.compact {
  margin-top: 0;
}

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

/* Teacher class ownership */
.create-class-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.create-class-row input {
  margin-top: 0;
  min-width: 0;
}

.teacher-class-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.teacher-class-item {
  padding: 11px;
  border: 1px solid var(--line);
  background: #fbfdfd;
}

.teacher-class-summary strong,
.teacher-class-summary span {
  display: block;
}

.teacher-class-summary span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.invite-code-row {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
}

.invite-code-row code {
  padding: 7px 9px;
  overflow: hidden;
  background: #fff7e4;
  border: 1px solid #e2cd91;
  color: #604b17;
  font-size: 14px;
  letter-spacing: 0;
}

.teacher-accordion-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.teacher-accordion-item {
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fbfdfd;
}

.teacher-accordion-button {
  width: 100%;
  min-height: 56px;
  padding: 10px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fbfdfd;
  color: var(--text);
  text-align: left;
}

.teacher-accordion-button:hover,
.teacher-accordion-button[aria-expanded="true"] {
  background: #eef7f7;
}

.teacher-accordion-button span,
.teacher-accordion-button strong,
.teacher-accordion-button small {
  display: block;
}

.teacher-accordion-button small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.teacher-accordion-button b {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid #bcd3d4;
  border-radius: 50%;
  color: var(--primary-strong);
  font-size: 18px;
  font-weight: 400;
}

.teacher-accordion-content {
  border-top: 1px solid var(--line);
  background: #fff;
}

.teacher-student-row,
.teacher-record-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 11px;
}

.teacher-student-row + .teacher-student-row,
.teacher-record-row + .teacher-record-row,
.accordion-empty + .teacher-record-row,
.class-export-row + .teacher-record-row,
.case-export-row + .teacher-record-row {
  border-top: 1px solid var(--line);
}

.teacher-student-row strong,
.teacher-student-row span,
.teacher-record-row strong,
.teacher-record-row span,
.teacher-record-row time {
  display: block;
}

.teacher-student-row span,
.teacher-record-row span,
.teacher-record-row time {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.teacher-record-row time {
  line-height: 1.45;
}

.class-export-row {
  min-height: 42px;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  background: #f7fafb;
}

.class-export-row .export-link {
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
}

.teacher-case-list {
  border-top: 1px solid var(--line);
}

.teacher-case-group + .teacher-case-group {
  border-top: 1px solid var(--line);
}

.teacher-case-button {
  width: 100%;
  min-height: 54px;
  padding: 10px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.teacher-case-button:hover,
.teacher-case-button[aria-expanded="true"] {
  background: #f0f8f8;
}

.teacher-case-button[aria-expanded="true"] {
  box-shadow: inset 3px 0 0 var(--primary);
}

.teacher-case-button span,
.teacher-case-button strong,
.teacher-case-button small {
  display: block;
}

.teacher-case-button strong {
  font-size: 13px;
  line-height: 1.45;
}

.teacher-case-button small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.teacher-case-button b {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid #c4d8d9;
  border-radius: 50%;
  color: var(--primary-strong);
  font-size: 16px;
  font-weight: 400;
}

.teacher-case-records {
  border-top: 1px solid var(--line);
  background: #fbfdfd;
}

.case-export-row {
  min-height: 38px;
  padding: 7px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  background: #f5f8f8;
}

.case-export-row .export-link {
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
}

.accordion-empty {
  margin: 0;
  padding: 13px 11px;
  color: var(--muted);
  font-size: 13px;
}

.danger-button {
  border-color: #d7a6a3;
  background: #fffafa;
  color: #9d312d;
}

.danger-button:hover {
  border-color: #bd6d68;
  background: #fff1f0;
  color: #862622;
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.sidebar-divider {
  height: 1px;
  margin: 18px 0;
  background: var(--line);
}

.sidebar-command {
  margin-top: 10px;
}

.sidebar-command-stack {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sidebar-command-stack .sidebar-command {
  margin-top: 0;
  padding: 0 8px;
}

.sidebar-note {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

/* Teacher assignment manager */
.assignment-header {
  padding: 4px 0 18px;
  border-bottom: 1px solid var(--line);
}

.assignment-header h2,
.assignment-header p {
  margin: 0;
}

.assignment-header h2 {
  font-size: 26px;
}

.assignment-header p:not(.analytics-kicker) {
  margin-top: 7px;
  color: var(--muted);
}

.assignment-form {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.assignment-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.assignment-form-grid label {
  margin-top: 0;
}

.assignment-publish-button {
  width: 100%;
  margin-top: 0;
}

.assignment-list-section {
  padding-top: 20px;
}

.assignment-history {
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.assignment-section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.assignment-section-title h3,
.assignment-section-title p {
  margin: 0;
}

.assignment-section-title h3 {
  font-size: 18px;
}

.assignment-section-title p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.assignment-list {
  border-top: 1px solid var(--line);
}

.assignment-row {
  min-height: 72px;
  padding: 12px 4px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

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

.assignment-row-main p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.assignment-status {
  display: inline-block;
  padding: 3px 7px;
  border: 1px solid;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.status-active {
  border-color: #7bb7a3;
  background: #eaf7f1;
  color: #27664e;
}

.status-scheduled {
  border-color: #89aeca;
  background: #edf5fb;
  color: #315f7d;
}

.status-closed,
.status-ended {
  border-color: #c4cfd1;
  background: #f2f5f5;
  color: #65747c;
}

.assignment-empty {
  margin: 0;
  padding: 20px 4px;
  color: var(--muted);
}

/* Teacher case manager */
.case-manager-header {
  padding: 4px 0 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.case-manager-header h2,
.case-manager-header p {
  margin: 0;
}

.case-manager-header h2 {
  font-size: 26px;
}

.case-manager-header p:not(.analytics-kicker) {
  max-width: 720px;
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.6;
}

.case-manager-header .primary {
  flex: 0 0 auto;
  margin-top: 0;
}

.case-manager-layout {
  min-height: 640px;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
}

.managed-case-sidebar {
  padding: 18px 16px 18px 0;
  border-right: 1px solid var(--line);
}

.managed-case-count {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 12px;
}

.managed-case-group + .managed-case-group {
  margin-top: 6px;
}

.managed-system-button {
  width: 100%;
  min-height: 54px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
}

.managed-system-button:hover,
.managed-system-button[aria-expanded="true"] {
  background: #f2f7f7;
}

.managed-system-button[aria-expanded="true"] {
  border-color: #c5dcda;
}

.managed-system-button span,
.managed-system-button strong,
.managed-system-button small {
  display: block;
  min-width: 0;
}

.managed-system-button strong {
  color: var(--text);
  line-height: 1.35;
}

.managed-system-button small {
  margin-top: 3px;
  color: var(--muted);
}

.managed-system-button b {
  width: 22px;
  flex: 0 0 22px;
  color: var(--primary-strong);
  font-size: 20px;
  font-weight: 400;
  text-align: center;
}

.managed-system-cases {
  margin: 5px 0 8px 10px;
  padding-left: 9px;
  border-left: 2px solid #d7e6e5;
}

.managed-case-button {
  width: 100%;
  min-height: 54px;
  padding: 9px 10px;
  display: grid;
  gap: 4px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
}

.managed-case-button + .managed-case-button {
  margin-top: 4px;
}

.managed-case-button:hover {
  background: #f2f7f7;
}

.managed-case-button.active {
  background: #eaf5f4;
  border-color: #afd0ce;
}

.managed-case-button span {
  color: var(--text);
  font-weight: 700;
  line-height: 1.35;
}

.managed-case-button small {
  color: var(--muted);
}

.managed-case-content {
  min-width: 0;
  padding: 20px 0 24px 22px;
}

.managed-case-placeholder,
.managed-case-loading {
  padding: 80px 20px;
  color: var(--muted);
  text-align: center;
}

.managed-case-placeholder h3 {
  margin: 0 0 8px;
  color: var(--text);
}

.managed-case-placeholder p {
  margin: 0;
}

.managed-case-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.managed-case-detail-header h3 {
  margin: 8px 0 6px;
  font-size: 24px;
}

.managed-case-detail-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

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

.managed-case-badges span {
  padding: 3px 7px;
  background: #edf5f5;
  border: 1px solid #c7dada;
  border-radius: 4px;
  color: var(--primary-strong);
  font-size: 11px;
}

.managed-case-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.managed-case-section h4 {
  margin: 0 0 12px;
  font-size: 17px;
}

.managed-case-section ul,
.managed-case-section ol {
  margin: 0;
  padding-left: 22px;
  line-height: 1.75;
}

.managed-info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.managed-info-grid div {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.managed-info-grid span,
.managed-info-grid strong {
  display: block;
}

.managed-info-grid span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.managed-scene-status {
  margin: 14px 0 0;
  line-height: 1.7;
}

.managed-fact-list,
.managed-rubric-list {
  border-top: 1px solid var(--line);
}

.managed-fact-row,
.managed-rubric-row {
  padding: 12px 0;
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr);
  gap: 4px 14px;
  border-bottom: 1px solid var(--line);
}

.managed-fact-row p,
.managed-rubric-row p {
  margin: 0;
  line-height: 1.65;
}

.managed-fact-row small {
  grid-column: 2;
  color: var(--muted);
  line-height: 1.5;
}

.managed-prompt-preview {
  margin: 0;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  background: #f4f8f8;
  border-left: 3px solid #85b9b7;
  color: var(--text);
  font: inherit;
  line-height: 1.7;
}

.managed-case-form fieldset {
  min-width: 0;
  margin: 0;
  padding: 22px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.managed-case-form legend {
  padding: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
}

.managed-form-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.managed-form-heading span {
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 700;
}

.managed-form-heading h3 {
  margin: 5px 0 0;
  font-size: 24px;
}

.managed-form-note,
.field-help {
  color: var(--muted);
  line-height: 1.65;
}

.managed-form-note {
  margin: 12px 0 0;
}

.field-help {
  margin: 8px 0 0;
  font-size: 12px;
}

.managed-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 14px;
}

.managed-facts-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 18px;
}

.managed-facts-form-grid label {
  margin-top: 14px;
}

.managed-facts-form-grid textarea {
  min-height: 92px;
  resize: vertical;
}

.managed-case-form fieldset > textarea {
  min-height: 124px;
  margin-top: 14px;
  resize: vertical;
}

.managed-requirements {
  margin: 0;
  padding-left: 12px;
  border-left: 3px solid #85b9b7;
  line-height: 1.75;
  white-space: pre-wrap;
}

.managed-form-actions {
  display: flex;
  justify-content: flex-end;
}

.managed-form-actions .primary {
  min-width: 140px;
}

/* Teacher class analytics */
.analytics-header {
  padding: 4px 0 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.analytics-kicker {
  margin: 0 0 6px !important;
  color: var(--primary-strong) !important;
  font-size: 13px;
  font-weight: 700;
}

.analytics-header h2 {
  margin: 0;
  font-size: 26px;
}

.analytics-header p:not(.analytics-kicker),
.analytics-panel-title p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.analytics-export {
  min-height: 36px;
  padding: 8px 12px;
  flex: 0 0 auto;
  border: 1px solid #b8d8d8;
  border-radius: 6px;
  background: var(--secondary);
  color: var(--primary-strong);
  text-decoration: none;
  font-size: 14px;
}

.analytics-metrics {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(6, minmax(100px, 1fr));
  gap: 10px;
}

.metric-card {
  min-height: 94px;
  padding: 13px;
  border: 1px solid var(--line);
  border-top-width: 4px;
  background: #fff;
}

.metric-teal {
  border-top-color: #27898b;
}

.metric-blue {
  border-top-color: #4c7ca5;
}

.metric-amber {
  border-top-color: #d2a33a;
}

.metric-card > span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric-card > strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 25px;
  line-height: 1;
}

.metric-card small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.analytics-insight {
  margin-top: 14px;
  padding: 13px 15px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  border-left: 4px solid #d2a33a;
  background: #fff9e8;
}

.analytics-insight strong {
  color: #71520a;
}

.analytics-insight p {
  margin: 0;
  color: #584c2f;
  line-height: 1.6;
}

.analytics-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.analytics-panel {
  padding: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.analytics-panel-title {
  min-height: 48px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.analytics-panel-title h3 {
  margin: 0;
  font-size: 17px;
}

.distribution-chart,
.dimension-chart {
  margin-top: 14px;
  display: grid;
  gap: 13px;
}

.distribution-row {
  display: grid;
  grid-template-columns: 78px minmax(80px, 1fr) 48px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.distribution-row > strong {
  text-align: right;
  font-weight: 600;
}

.chart-track {
  width: 100%;
  height: 9px;
  overflow: hidden;
  background: #e8eeee;
  border-radius: 5px;
}

.chart-fill {
  height: 100%;
  display: block;
  min-width: 0;
  border-radius: 5px;
}

.chart-teal {
  background: #27898b;
}

.chart-blue {
  background: #4c7ca5;
}

.chart-amber {
  background: #d2a33a;
}

.chart-orange {
  background: #c8793e;
}

.chart-red {
  background: #b95d5d;
}

.dimension-row {
  display: grid;
  grid-template-columns: 126px minmax(80px, 1fr) 38px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.dimension-row > div:first-child {
  min-width: 0;
}

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

.dimension-row span {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dimension-row strong,
.dimension-row small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 400;
}

.dimension-row > small {
  margin: 0;
  text-align: right;
}

.analytics-table-panel {
  margin-top: 14px;
}

.analysis-report-panel {
  margin-top: 14px;
}

.analysis-report-panel .analytics-panel-title {
  align-items: center;
}

.analysis-report-state {
  margin-top: 12px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.analysis-report-empty,
.analysis-report-error {
  margin: 0;
  padding: 18px 12px;
  text-align: center;
  background: #f7fafb;
}

.analysis-report-error {
  color: var(--danger);
  background: #fff5f4;
}

.analysis-stale {
  margin: 0 0 14px;
  padding: 9px 11px;
  border-left: 3px solid #d2a33a;
  background: #fff9e8;
  color: #71520a;
}

.analysis-overview {
  padding: 0 0 15px;
}

.analysis-overview strong {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
}

.analysis-overview p {
  margin: 0;
  color: var(--text);
  line-height: 1.75;
}

.analysis-report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.analysis-report-section {
  min-width: 0;
  padding: 14px 16px 14px 0;
}

.analysis-report-section + .analysis-report-section {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.analysis-report-section h4 {
  margin: 0 0 9px;
  font-size: 14px;
}

.analysis-report-section.strength h4 {
  color: #286844;
}

.analysis-report-section.weakness h4 {
  color: #9a4f28;
}

.analysis-report-section.suggestion h4 {
  color: #315f86;
}

.analysis-report-section ul {
  margin: 0;
  padding-left: 18px;
}

.analysis-report-section li {
  margin-bottom: 7px;
  color: var(--text);
  line-height: 1.6;
}

.analysis-list-empty {
  margin: 0;
}

.analysis-generated-time {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.analysis-report-loading {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #f7fafb;
}

.analysis-report-loading span {
  width: 18px;
  height: 18px;
  border: 2px solid #c7dada;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: report-spin 0.8s linear infinite;
}

.analysis-report-loading p {
  margin: 0;
}

@keyframes report-spin {
  to {
    transform: rotate(360deg);
  }
}

.analytics-table-wrap {
  margin: 12px -16px -16px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.analytics-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 13px;
}

.analytics-table th,
.analytics-table td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.analytics-table th {
  background: #f4f8f8;
  color: var(--muted);
  font-weight: 600;
}

.analytics-table tbody tr:last-child td {
  border-bottom: 0;
}

.analytics-table td:first-child strong,
.analytics-table td:first-child small {
  display: block;
}

.analytics-table td:first-child small {
  margin-top: 3px;
  color: var(--muted);
}

.status-badge {
  display: inline-block;
  padding: 4px 7px;
  border: 1px solid;
  border-radius: 5px;
  font-size: 12px;
}

.status-badge.submitted {
  border-color: #9ac6b0;
  background: #eff9f3;
  color: #286844;
}

.status-badge.active {
  border-color: #d8c78e;
  background: #fff9e8;
  color: #71520a;
}

.analytics-empty {
  margin: 12px 0 0;
  padding: 20px 12px;
  color: var(--muted);
  text-align: center;
  background: #f7fafb;
}

.back-to-analytics {
  margin-bottom: 12px;
}

@media (max-width: 1180px) {
  .assignment-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .case-manager-layout {
    grid-template-columns: 205px minmax(0, 1fr);
  }

  .managed-info-grid,
  .managed-form-grid,
  .managed-facts-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-metrics {
    grid-template-columns: repeat(3, minmax(100px, 1fr));
  }

  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .student-welcome {
    min-height: auto;
    align-content: start;
    padding: 42px 14px;
  }

  .welcome-lead {
    font-size: 13px;
  }
}

@media (max-width: 760px) {
  .assignment-form-grid {
    grid-template-columns: 1fr;
  }

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

  .assignment-row .danger-button {
    justify-self: start;
  }

  .case-manager-header,
  .managed-case-detail-header {
    flex-direction: column;
  }

  .case-manager-layout {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .managed-case-sidebar {
    padding: 16px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .managed-case-content {
    padding: 18px 0;
  }

  .managed-info-grid,
  .managed-form-grid,
  .managed-facts-form-grid,
  .managed-fact-row,
  .managed-rubric-row {
    grid-template-columns: 1fr;
  }

  .managed-fact-row small {
    grid-column: 1;
  }

  .overview-chips {
    align-items: flex-start;
    flex-direction: column;
  }

  .analytics-header {
    align-items: stretch;
    flex-direction: column;
  }

  .analytics-export {
    align-self: flex-start;
  }

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

  .analytics-insight {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .analysis-report-panel .analytics-panel-title {
    align-items: stretch;
    flex-direction: column;
  }

  .analysis-report-panel .analytics-panel-title button {
    align-self: flex-start;
  }

  .analysis-report-grid {
    grid-template-columns: 1fr;
  }

  .analysis-report-section,
  .analysis-report-section + .analysis-report-section {
    padding: 13px 0;
    border-left: 0;
  }

  .analysis-report-section + .analysis-report-section {
    border-top: 1px solid var(--line);
  }

  .distribution-row {
    grid-template-columns: 72px minmax(60px, 1fr) 44px;
    gap: 7px;
  }

  .dimension-row {
    grid-template-columns: 112px minmax(60px, 1fr) 34px;
    gap: 7px;
  }

  .student-welcome {
    min-height: auto;
    padding: 48px 8px;
  }

  .student-welcome h2 {
    font-size: 27px;
  }

  .welcome-lead {
    font-size: 16px;
    white-space: normal;
  }

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

  .welcome-values span:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .welcome-values span:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .case-overview-heading,
  .attempt-tools {
    align-items: flex-start;
    flex-direction: column;
  }

  .case-start-bar {
    grid-template-columns: 1fr;
  }

  .case-start-bar .primary {
    width: 100%;
  }

  .case-overview-heading h3 {
    font-size: 22px;
  }

  .patient-info-grid {
    grid-template-columns: 1fr;
  }
}
