:root {
  --ink: #1f2933;
  --muted: #62717f;
  --line: #d9e2ec;
  --paper: #f7f9fb;
  --surface: #ffffff;
  --teal: #167d7f;
  --teal-dark: #0f5f61;
  --coral: #d45d4c;
  --amber: #b7791f;
  --green: #2f855a;
  --blue: #2b6cb0;
  --shadow: 0 14px 40px rgba(31, 41, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 350px) 1fr;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.sidebar {
  background: #ffffff;
  border-right: 1px solid var(--line);
  padding: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  min-width: 0;
}

.course-title h1,
.teacher-header h1 {
  margin: 6px 0 0;
  font-size: 26px;
  line-height: 1.15;
}

.eyebrow {
  color: var(--teal-dark);
  font-size: 12px;
  letter-spacing: 0;
  font-weight: 700;
  text-transform: uppercase;
}

.identity-panel,
.progress-panel,
.teacher-login {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
}

.identity-panel label,
.teacher-login label {
  display: block;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  margin: 0 0 6px;
}

.identity-panel input,
.teacher-login input,
.reflection-box textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  margin-bottom: 12px;
  background: #fff;
  color: var(--ink);
}

.primary-button,
.ghost-button {
  border: 0;
  border-radius: 6px;
  padding: 11px 14px;
  font-weight: 700;
}

.primary-button {
  background: var(--teal);
  color: #fff;
  width: 100%;
  max-width: 100%;
}

.primary-button:hover {
  background: var(--teal-dark);
}

.ghost-button {
  color: var(--ink);
  background: #eef3f7;
  border: 1px solid transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ghost-button:hover {
  border-color: var(--line);
  background: #fff;
}

.small-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 8px 0 0;
}

.progress-panel {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 14px;
  align-items: center;
}

.progress-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--green) 0deg, #e8eef3 0deg);
}

.progress-ring span {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  font-weight: 800;
}

.module-nav {
  margin-top: 22px;
  display: grid;
  gap: 10px;
}

.part-heading {
  margin: 14px 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.module-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 11px;
  text-align: left;
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.module-button span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.module-button.active {
  border-color: var(--teal);
  box-shadow: inset 4px 0 0 var(--teal);
}

.module-number {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #edf7f7;
  color: var(--teal-dark);
  font-weight: 800;
  font-size: 13px;
}

.module-done {
  color: var(--green);
  font-weight: 900;
}

.teacher-link {
  display: block;
  margin-top: 22px;
  color: var(--teal-dark);
  font-weight: 700;
}

.course-main {
  min-width: 0;
}

.topbar {
  min-height: 92px;
  padding: 22px 34px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 3;
}

.topbar h2 {
  margin: 4px 0 0;
  font-size: 28px;
  line-height: 1.15;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.module-content {
  padding: 32px 34px 56px;
  max-width: 1180px;
}

.welcome-band,
.module-hero,
.activity,
.reference-panel,
.teacher-note {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.welcome-band {
  min-height: 280px;
  display: grid;
  align-items: center;
  padding: 36px;
}

.module-hero {
  overflow: hidden;
  margin-bottom: 22px;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 24px;
  padding: 24px;
}

.hero-inner h3 {
  margin: 0 0 10px;
  font-size: 24px;
}

.hero-inner p {
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 14px;
}

.goal-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 16px 0 0;
  list-style: none;
}

.goal-list li {
  padding-left: 22px;
  position: relative;
}

.goal-list li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--coral);
  position: absolute;
  left: 2px;
  top: 8px;
}

.visual-panel {
  min-height: 260px;
  border-radius: 8px;
  background: #f1f6f8;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  padding: 16px;
}

.visual-panel svg {
  width: 100%;
  max-height: 310px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
  align-items: start;
}

.card-list {
  display: grid;
  gap: 16px;
}

.lesson-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: 8px;
  padding: 18px 18px 30px;
  position: relative;
}

.lesson-card h4,
.activity h4,
.reference-panel h4,
.teacher-note h4 {
  margin: 0 0 10px;
  font-size: 18px;
}

.lesson-card p,
.lesson-card li,
.activity p,
.activity li,
.reference-panel li,
.teacher-note p {
  line-height: 1.55;
}

.lesson-card p {
  margin: 0 0 10px;
}

.side-stack {
  display: grid;
  gap: 16px;
}

.teacher-note,
.reference-panel {
  padding: 16px;
  box-shadow: none;
}

.reference-panel ul,
.teacher-note ul {
  padding-left: 18px;
  margin: 0;
}

.activity-list {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.item-number {
  position: absolute;
  right: 12px;
  bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

.audience-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid #cfe0e4;
  border-radius: 999px;
  padding: 4px 9px;
  margin: 0 0 10px;
  background: #f1f6f8;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
}

.inline-figure {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.inline-figure svg {
  width: 100%;
  max-height: 320px;
  display: block;
}

.source-page-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.source-page {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}

.source-page img {
  display: block;
  width: 100%;
  height: auto;
}

.source-page figcaption {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.example-box {
  margin-top: 12px;
  border: 1px solid #f2d6a1;
  background: #fff8e8;
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.5;
}

.case-scenario {
  border-left: 4px solid var(--amber);
  background: #fff8e8;
  padding: 12px 14px;
  border-radius: 6px;
}

.case-questions {
  margin: 12px 0;
  padding-left: 24px;
}

.self-check {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
}

.self-check summary {
  cursor: pointer;
  font-weight: 700;
}

.self-check.locked {
  color: var(--muted);
  font-size: 14px;
}

.activity {
  padding: 18px 18px 30px;
  box-shadow: none;
  position: relative;
}

.case-activity textarea:disabled {
  background: #f8fafc;
  color: var(--ink);
}

.choice-list,
.match-list,
.sort-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.choice-option,
.match-item,
.sort-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.choice-option {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
}

.choice-option input {
  margin-top: 3px;
}

.match-item {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 1fr);
  gap: 12px;
  align-items: center;
}

.match-item select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.activity-result {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #f1f6f8;
  color: var(--ink);
  display: none;
}

.activity-result.visible {
  display: block;
}

.activity-result.correct {
  border-left: 5px solid var(--green);
}

.activity-result.partial {
  border-left: 5px solid var(--amber);
}

.reflection-box textarea {
  min-height: 110px;
  resize: vertical;
}

.complete-bar {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  background: #edf7f7;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
}

.teacher-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px;
}

.teacher-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.teacher-header p {
  color: var(--muted);
  margin: 8px 0 0;
}

.inline-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.inline-form .primary-button {
  width: auto;
}

.dashboard-grid {
  display: grid;
  gap: 18px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}

.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.metric strong {
  display: block;
  font-size: 28px;
}

.dashboard-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.teacher-answer-panel h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.answer-student {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
  background: #f8fafc;
}

.answer-student summary {
  cursor: pointer;
}

.answer-card {
  margin-top: 12px;
  border-left: 4px solid var(--teal);
  background: #fff;
  padding: 12px;
  border-radius: 6px;
}

.answer-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.answer-card pre {
  white-space: pre-wrap;
  font-family: inherit;
  margin: 8px 0 0;
  line-height: 1.45;
}

.progress-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.progress-table th,
.progress-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.progress-table th {
  background: #f1f6f8;
  color: var(--muted);
  font-weight: 800;
}

.module-cell {
  min-width: 58px;
  text-align: center;
}

.score-ok {
  color: var(--green);
  font-weight: 800;
}

.score-warn {
  color: var(--amber);
  font-weight: 800;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .module-nav {
    max-height: 360px;
    overflow: auto;
    padding-right: 4px;
  }

  .topbar {
    position: relative;
  }

  .hero-inner,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .metric-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .sidebar,
  .topbar,
  .module-content,
  .teacher-page {
    padding: 18px;
  }

  .topbar,
  .teacher-header,
  .inline-form,
  .complete-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .match-item {
    grid-template-columns: 1fr;
  }

  .metric-strip {
    grid-template-columns: 1fr;
  }
}
