:root {
  --bg: #f5f8ff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-soft: #f8fbff;
  --line: #dbe5f5;
  --ink: #1a2740;
  --muted: #687a98;
  --accent: #5f8fff;
  --accent-deep: #456ddb;
  --accent-soft: #e8f0ff;
  --sage: #34a587;
  --danger: #cc4f68;
  --shadow: 0 16px 40px rgba(32, 54, 98, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(95, 143, 255, 0.10), transparent 24%),
    radial-gradient(circle at top left, rgba(52, 165, 135, 0.08), transparent 26%),
    linear-gradient(180deg, #fbfdff 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(91, 122, 182, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 122, 182, 0.03) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1240px, calc(100% - 28px));
  margin: 18px auto 36px;
}

.topbar,
.hero-card,
.panel,
.review-card,
.assignment-card,
.submission-card,
.step-card,
.teacher-ready-card,
.playback-screen,
.timeline-card,
.feedback-card,
.idea-card,
.empty-state,
.stat-card,
.notice,
.student-card {
  background: var(--surface);
  border: 1px solid rgba(217, 227, 240, 0.92);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
}

.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-mark-auth {
  width: 44px;
  height: 44px;
}

.brand-wordmark {
  margin: 0;
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  letter-spacing: -0.04em;
  line-height: 1;
}

.auth-wordmark {
  font-size: 1.3rem;
}

.brand-accent-letter {
  font-weight: inherit;
  color: var(--accent-deep);
}

.brand h1,
.panel-title,
.hero h2,
.assignment-card h3,
.review-header h2,
.step-card h3,
.student-card h3 {
  margin: 0;
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  letter-spacing: -0.035em;
}

.brand p,
.subtle,
.stat-label,
.rubric-description,
.empty-state p,
.timeline-card p,
.student-task {
  margin: 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.toolbar select,
.toolbar button,
.field input,
.field textarea,
.field select,
.review-edit input,
.review-edit textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}

.toolbar select,
.toolbar button,
.field input,
.field select {
  min-height: 44px;
  padding: 0 14px;
}

.field textarea,
.draft-editor,
.final-editor,
.reflection-input,
.teacher-brief,
.review-edit textarea {
  width: 100%;
  min-height: 120px;
  padding: 14px 16px;
  resize: vertical;
}

.button,
.button-secondary,
.button-ghost,
.pill,
.status-pill,
.warning-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
}

.button {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  box-shadow: 0 10px 24px rgba(95, 143, 255, 0.22);
}

.button-secondary {
  background: #edf3ff;
  color: #3d62c9;
}

.button-ghost {
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  border: 1px solid var(--line);
}

.button:disabled,
.button-secondary:disabled,
.button-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hero {
  margin-top: 18px;
}

.hero-card {
  padding: 24px;
}

.hero-simple {
  display: block;
}

.teacher-grid,
.review-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
  margin-top: 18px;
}

.review-shell {
  margin-top: 18px;
  padding: 20px;
}

.review-grid {
  margin-top: 0;
}

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

.student-shell {
  margin-top: 18px;
}

.panel,
.review-card,
.assignment-card,
.submission-card,
.step-card,
.student-card,
.teacher-ready-card {
  padding: 20px;
}

.panel-tight {
  padding: 20px;
}

.panel-header,
.section-header,
.review-header,
.step-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.field-stack,
.review-stack,
.idea-list,
.feedback-list,
.student-list,
.assignment-list,
.timeline-list {
  display: grid;
  gap: 14px;
}

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

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

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

.field label,
.mini-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #31405f;
}

.teacher-brief {
  min-height: 220px;
}

.teacher-output {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.teacher-ready-card {
  background: var(--surface-soft);
  border: 1px solid rgba(217, 227, 240, 0.9);
}

.student-list,
.timeline-list {
  max-height: 480px;
  overflow: auto;
}

.assignment-list {
  max-height: 680px;
  overflow: auto;
}

.simple-card {
  padding: 16px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pill,
.status-pill,
.warning-pill {
  min-height: 28px;
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 700;
}

.pill {
  background: #eaf2ff;
  color: #3855a8;
}

.status-pill {
  background: #ecf4ff;
  color: #2f61c7;
}

.warning-pill {
  background: #ffe8ee;
  color: var(--danger);
}

.compact-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stats-grid {
  display: grid;
  gap: 12px;
}

.stat-card {
  padding: 16px;
}

.stat-value {
  display: block;
  margin-top: 8px;
  font-size: 1.35rem;
  font-weight: 700;
}

.playback-controls {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.slider {
  width: 100%;
}

.playback-screen {
  min-height: 340px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.94);
}

.playback-screen pre,
.compare-column pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", "Menlo", monospace;
  line-height: 1.55;
}

/* Editable AI draft */
.assist-title-input {
  width: 100%;
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  background: #fff;
  color: var(--ink);
  margin-top: 6px;
}

.rubric-edit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.rubric-edit-fields {
  flex: 1;
  display: grid;
  gap: 6px;
}

.rubric-edit-fields input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: #f7faff;
  color: var(--ink);
}

.rubric-edit-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.rubric-edit-right input[type="number"] {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: #f7faff;
  color: var(--ink);
  text-align: center;
}

.submitted-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: #eefbf7;
  border: 1px solid #cdece2;
  margin-bottom: 20px;
}

.submitted-banner strong {
  display: block;
  font-size: 1.05rem;
  color: #17765c;
}

.submitted-banner p {
  margin: 4px 0 0;
  color: #3d6c63;
  font-size: 0.9rem;
}

.submitted-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: linear-gradient(135deg, #34a587, #2d7cc7);
  color: white;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.context-expand-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}

.compare-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.compare-col-header .mini-label {
  margin: 0;
}

.context-snippet {
  overflow: hidden;
  max-height: 90px;
  mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

.subtle-clamp {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink);
}

.context-expanded-panel {
  margin-top: 18px;
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.context-expanded-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.context-expanded-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", "Menlo", monospace;
  line-height: 1.65;
  font-size: 0.92rem;
}

.timeline-card,
.feedback-card,
.idea-card {
  padding: 16px;
  background: rgba(255, 255, 255, 0.94);
}

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

.compare-column {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
}

.focus-list,
.feedback-card ul,
.idea-card ul {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.focus-list li,
.feedback-card li {
  margin-top: 8px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}

.muted-block {
  padding: 13px 14px;
  border-radius: 12px;
  background: #eef4fb;
  color: #304560;
}

.rubric-score {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.rubric-schema-shell {
  display: grid;
  gap: 14px;
}

.rubric-schema-shell-compact {
  gap: 12px;
}

.rubric-schema-shell-preview {
  gap: 10px;
}

.rubric-schema-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.rubric-schema-title {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.rubric-schema-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.rubric-schema-summary {
  text-align: right;
}

.rubric-schema-score {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
}

.rubric-schema-score strong {
  font-size: 1.6rem;
  line-height: 1;
}

.rubric-schema-score span {
  font-size: 0.92rem;
  color: var(--muted);
}

.rubric-schema-meta {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--muted);
}

.rubric-note-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #d7e5ff;
  background: #f4f8ff;
  font-size: 0.84rem;
  color: #4b679f;
}

.rubric-level-legend {
  display: grid;
  gap: 8px;
}

.rubric-level-legend-chip,
.rubric-level-badge,
.rubric-selection-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 8px 14px;
  border-radius: 14px;
  border: 1px solid rgba(78, 103, 156, 0.10);
  font-size: 0.76rem;
  line-height: 1.25;
  font-weight: 700;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

.rubric-level-legend-chip {
  width: 100%;
}

.rubric-schema-criteria {
  display: grid;
  gap: 14px;
}

.rubric-criterion-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: linear-gradient(180deg, #fcfdff 0%, #fff 100%);
}

.rubric-criterion-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.rubric-level-badge {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  justify-content: center;
}

.rubric-criterion-name {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.rubric-criterion-range {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--muted);
}

.rubric-level-grid {
  display: grid;
  gap: 8px;
}

.rubric-level-grid-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.rubric-level-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rubric-level-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rubric-level-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rubric-level-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.rubric-level-grid-preview { grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); }

.rubric-level-cell {
  display: grid;
  gap: 8px;
  width: 100%;
  min-height: 124px;
  padding: 12px;
  border: 1px solid #e7ddd0;
  border-radius: 14px;
  background: #fff;
  text-align: left;
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(62, 41, 26, 0.04);
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

button.rubric-level-cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(62, 41, 26, 0.08);
}

.rubric-level-text {
  display: block;
  font-size: 0.84rem;
  line-height: 1.55;
  color: #394239;
}

.rubric-level-text strong {
  color: #202720;
}

.rubric-schema-attribution {
  margin: 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.rubric-schema-shell-compact .rubric-schema-title {
  font-size: 1rem;
}

.rubric-schema-shell-compact .rubric-criterion-card {
  padding: 10px;
}

.rubric-schema-shell-compact .rubric-level-cell {
  min-height: 92px;
  padding: 10px;
}

.rubric-schema-shell-compact .rubric-level-text {
  font-size: 0.78rem;
}

.rubric-schema-shell-preview .rubric-schema-header {
  align-items: center;
}

.rubric-schema-shell-preview .rubric-schema-summary {
  text-align: left;
}

.rubric-schema-shell-preview .rubric-schema-score strong {
  font-size: 1.2rem;
}

.rubric-schema-shell-preview .rubric-note-strip {
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
}

.rubric-schema-shell-preview .rubric-criterion-card {
  padding: 10px;
  border-radius: 14px;
}

.rubric-schema-shell-preview .rubric-level-cell {
  min-height: 0;
  padding: 10px;
  border-radius: 12px;
  box-shadow: none;
}

.rubric-schema-shell-preview .rubric-level-text {
  font-size: 0.79rem;
  line-height: 1.45;
}

.review-edit {
  display: grid;
  gap: 12px;
}

.notice {
  margin-top: 16px;
  padding: 13px 16px;
  color: #3d5238;
  background: #ecf4ea;
}

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

.compact-empty {
  padding: 22px;
}

.student-panel {
  padding: 20px;
}

.student-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.progress-step {
  padding: 12px 14px;
  border-radius: 14px;
  background: #f3eee5;
  border: 1px solid var(--line);
  color: var(--muted);
}

.progress-step span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-weight: 700;
}

.progress-step.active {
  background: #f8e7dd;
  border-color: #e4bea9;
  color: var(--ink);
}

.progress-step.active span,
.progress-step.done span {
  background: var(--accent);
  color: white;
}

.progress-step.done {
  background: #edf4ea;
  border-color: #cbddc6;
  color: var(--ink);
}

.student-card {
  margin-top: 16px;
}

.wizard-card {
  margin-top: 16px;
}

.draft-editor,
.final-editor {
  min-height: 320px;
  line-height: 1.65;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.editor-with-lines {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.review-editor-with-lines {
  grid-template-columns: 56px minmax(0, 1fr);
}

.line-gutter {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f6f9ff;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.65;
  padding: 14px 6px 14px 0;
  text-align: right;
  overflow: hidden;
  user-select: none;
}

.line-gutter-row {
  min-height: calc(1rem * 1.65);
}

.editor-with-lines .draft-editor,
.editor-with-lines .final-editor,
.editor-with-lines #student-text-annotate {
  margin: 0;
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  gap: 12px;
}

.inline-end {
  align-self: end;
}

.submission-status {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 1100px) {
  .teacher-grid,
  .review-grid,
  .compare-grid {
    grid-template-columns: 1fr;
  }

  .rubric-level-grid-4,
  .rubric-level-grid-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 18px, 100%);
    margin: 10px auto 24px;
  }

  .topbar,
  .panel,
  .review-card,
  .assignment-card,
  .submission-card,
  .step-card,
  .hero-card,
  .student-card {
    padding: 16px;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 12px;
  }

  .topbar .brand {
    flex: 1 1 100%;
  }

  .topbar .toolbar {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .topbar .toolbar select,
  .topbar .toolbar button {
    flex: 1 1 auto;
    min-width: 0;
  }

  .panel-header,
  .section-header,
  .review-header,
  .step-head,
  .card-top,
  .rubric-schema-header,
  .rubric-criterion-header {
    flex-direction: column;
  }

  .wizard-nav {
    flex-direction: row;
    justify-content: space-between;
  }

  .field-grid,
  .student-progress,
  .compact-stats {
    grid-template-columns: 1fr;
  }

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

  .review-shell {
    padding: 14px;
  }

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

  .rubric-level-grid,
  .rubric-level-grid-2,
  .rubric-level-grid-3,
  .rubric-level-grid-4,
  .rubric-level-grid-5 {
    grid-template-columns: 1fr;
  }

  .rubric-level-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .rubric-level-legend-chip,
  .rubric-level-badge,
  .rubric-selection-pill {
    min-height: 52px;
    padding: 10px 12px;
    font-size: 0.74rem;
  }

  .rubric-level-cell {
    min-height: 0;
  }

  .draft-editor,
  .final-editor {
    min-height: 220px;
  }

  .editor-with-lines,
  .review-editor-with-lines {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 8px;
  }

  .line-gutter {
    font-size: 0.68rem;
    padding-right: 4px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    font-size: 0.85rem;
  }

  .brand h1 {
    font-size: 1.1rem;
  }

  .chatbot-window {
    min-height: 200px;
    max-height: 300px;
  }

  .chat-input-row {
    flex-direction: column;
  }

  .chat-input-row .button {
    width: 100%;
  }

  .pill-row {
    gap: 6px;
  }

  .student-list,
  .timeline-list {
    max-height: 320px;
  }

  .assignment-list {
    max-height: 420px;
  }
}

/* ── Chatbot ─────────────────────────────────────────────── */
.chatbot-window {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 280px;
  max-height: 420px;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fafaf8;
  scroll-behavior: smooth;
}

.chat-message {
  display: flex;
  flex-direction: column;
  max-width: 82%;
}

.chat-assistant {
  align-self: flex-start;
}

.chat-user {
  align-self: flex-end;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.55;
  font-size: 0.93rem;
}

.chat-assistant .chat-bubble {
  background: var(--accent-soft);
  border-bottom-left-radius: 4px;
  color: var(--ink);
}

.chat-user .chat-bubble {
  background: #edf4ea;
  border-bottom-right-radius: 4px;
  color: var(--ink);
}

/* Typing indicator */
.chat-loading {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}

.chat-loading span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: chat-bounce 1.1s infinite ease-in-out;
}

.chat-loading span:nth-child(2) { animation-delay: 0.18s; }
.chat-loading span:nth-child(3) { animation-delay: 0.36s; }

@keyframes chat-bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%            { transform: scale(1);   opacity: 1;   }
}

.chat-input-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  resize: none;
  background: #fff;
  color: var(--ink);
  line-height: 1.5;
  font-size: 0.93rem;
}

.chat-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Timer badge */
.chat-timer {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: #edf4ea;
  color: #4d6148;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-timer-urgent {
  background: #f7dfdf;
  color: var(--danger);
}

/* ── Error code toolbar ───────────────────────────────────── */
.error-code-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: var(--surface-soft);
}

.error-code-toolbar + textarea {
  border-radius: 0 0 12px 12px;
}

.error-code-btn {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  font-family: "SFMono-Regular", "Menlo", monospace;
}

.error-code-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-deep);
}

/* Error code key shown to students */
.error-code-key {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #f4f0e8;
  font-size: 0.84rem;
}

.error-code-key p {
  margin: 0 0 6px;
  font-weight: 700;
  color: #3c4538;
}

.error-code-key dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 12px;
}

.error-code-key dt {
  font-weight: 700;
  font-family: "SFMono-Regular", "Menlo", monospace;
  color: var(--accent-deep);
}

.error-code-key dd {
  margin: 0;
  color: #3c4538;
}

/* ── Deadline overdue pill ────────────────────────────────── */
.overdue-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 999px;
  background: #f7dfdf;
  color: var(--danger);
}

.self-assessment-row {
  display: flex;
  gap: 8px;
}

.sa-option {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.sa-option:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.sa-selected {
  background: var(--accent);
  border-color: var(--accent-deep);
  color: white;
}

.paste-highlight {
  background: #e9d0f7;
  border-bottom: 2px solid #9b4dca;
  box-shadow: inset 0 0 0 1px rgba(155, 77, 202, 0.38);
  color: inherit;
  border-radius: 2px;
  cursor: help;
  scroll-margin-top: 120px;
}

.paste-evidence-panel {
  border-color: #c9a8ef;
  background: linear-gradient(135deg, #fbf7ff, #ffffff);
}

.paste-evidence-card {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid #d8c4f2;
  border-radius: 14px;
  background: #ffffff;
  padding: 12px 14px;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.paste-evidence-card summary {
  cursor: pointer;
  list-style-position: inside;
}

.paste-evidence-card:hover {
  border-color: #9b4dca;
  box-shadow: 0 10px 24px rgba(84, 47, 128, 0.08);
}

.paste-evidence-excerpts {
  display: grid;
  gap: 10px;
}

.paste-evidence-excerpts p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
}

.paste-evidence-fulltext {
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}

.teacher-feedback-comparison {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

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

.comparison-grid p {
  margin: 0;
  line-height: 1.55;
}

.class-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #edf4ea;
  border: 1px solid #cbddc6;
  color: #2e5c28;
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.class-banner-icon {
  font-size: 1.1rem;
}

.upcoming-section {
  margin-bottom: 18px;
}

.upcoming-class-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fff;
}

.upcoming-class-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.upcoming-assignment-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}
