:root {
  --bg: #07090f;
  --bg2: #0d1117;
  --bg3: #141b26;
  --bg4: #1a2235;
  --border: rgba(88, 166, 255, 0.16);
  --border2: rgba(88, 166, 255, 0.34);
  --blue: #58a6ff;
  --blue2: #1f6feb;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --text: #e6edf3;
  --text2: #8b949e;
  --text3: #5c6570;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 9, 15, 0.94);
  backdrop-filter: blur(14px);
}

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

.logo-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: linear-gradient(135deg, #1f6feb, #58a6ff);
  color: #fff;
  font-weight: 800;
}

.logo-name {
  font-weight: 700;
}

.logo-sub {
  margin-top: 2px;
  color: var(--text3);
  font-size: 10px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text2);
  font-size: 12px;
}

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

.status-dot.warn {
  background: var(--yellow);
}

.main-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: calc(100vh - 52px);
  min-height: 0;
  overflow: hidden;
}

.left-panel {
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg2);
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.mode-btn {
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
}

.mode-btn:hover {
  border-color: var(--border2);
  color: var(--text);
}

.mode-btn.active {
  border-color: rgba(88, 166, 255, 0.55);
  background: rgba(31, 111, 235, 0.18);
  color: var(--text);
}

.section {
  border-bottom: 1px solid var(--border);
}

.section-title {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.section-title:hover {
  background: rgba(88, 166, 255, 0.08);
}

.section-body {
  padding: 0 16px 16px;
}

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

.history-item {
  display: grid;
  gap: 6px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg3);
  color: var(--text2);
  cursor: pointer;
  padding: 10px;
  text-align: left;
}

.history-item:hover {
  border-color: var(--border2);
  color: var(--text);
}

.history-item.selected {
  border-color: var(--blue);
  background: rgba(31, 111, 235, 0.16);
  color: var(--text);
}

.history-item-title {
  color: var(--text);
  font-weight: 700;
}

.history-item-meta,
.history-empty {
  color: var(--text3);
  font-size: 11px;
}

.history-item-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.history-item-stats span {
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.1);
  color: var(--blue);
  font-size: 10px;
  padding: 2px 7px;
}

.roster-textarea {
  min-height: 94px;
  resize: vertical;
}

.roster-status {
  margin-top: 8px;
  color: var(--text3);
  font-size: 11px;
  line-height: 1.45;
}

.workflow-hint {
  margin-top: 8px;
  color: var(--text3);
  font-size: 11px;
  line-height: 1.45;
}

.workflow-hint.ready {
  color: var(--green);
}

.workflow-hint.warn,
.workflow-hint.important {
  color: var(--yellow);
}

.workflow-hint.error {
  color: var(--red);
}

.roster-list {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  margin-top: 10px;
}

.auth-summary {
  margin-top: 8px;
  color: var(--text3);
  font-size: 11px;
  line-height: 1.45;
}

.auth-summary.locked {
  color: var(--green);
}

.auth-summary.warn {
  color: var(--yellow);
}

.auth-summary.error {
  color: var(--red);
}

.roster-empty,
.roster-item {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg3);
  color: var(--text2);
  padding: 8px 10px;
}

.roster-item {
  display: grid;
  grid-template-columns: minmax(74px, 0.9fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.roster-item strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-item em {
  color: var(--text3);
  font-size: 10px;
  font-style: normal;
}

.history-empty {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.history-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}

.history-thumb {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  color: var(--text2);
  cursor: zoom-in;
  text-align: left;
}

.history-thumb:hover,
.history-thumb:focus-visible {
  border-color: var(--border2);
  color: var(--text);
}

.history-thumb img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  background: #fff;
}

.history-thumb span {
  padding: 0 8px 8px;
  font-size: 11px;
}

.history-detail {
  display: grid;
  gap: 14px;
  max-width: 1060px;
}

.history-detail-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg2);
  padding: 16px;
}

.history-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.history-detail-head h2 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 15px;
}

.history-detail-head p {
  color: var(--text3);
  font-size: 11px;
}

.history-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.history-metric {
  min-height: 72px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg3);
  padding: 12px;
}

.history-metric span {
  display: block;
  color: var(--text3);
  font-size: 11px;
}

.history-metric strong {
  display: block;
  margin-top: 10px;
  color: var(--text);
  font-size: 20px;
}

.history-metric.primary strong {
  color: var(--blue);
}

.history-metric.ok strong {
  color: var(--green);
}

.history-metric.warn strong {
  color: var(--yellow);
}

.history-report-body {
  color: var(--text2);
}

.history-report-body > p {
  margin: 0;
}

.history-error-list,
.history-correction-list {
  display: grid;
  gap: 10px;
}

.history-error-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg3);
  padding: 12px;
}

.history-error-item > div:first-child {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.history-error-item strong {
  color: var(--text);
}

.history-error-item span {
  color: var(--text3);
  font-size: 11px;
}

.history-error-item dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.history-error-item dl div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
}

.history-error-item dt {
  color: var(--text3);
}

.history-error-item dd {
  margin: 0;
  color: var(--text2);
}

.history-correction-item {
  display: flex;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg3);
  padding: 12px;
}

.history-correction-item > span {
  display: grid;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  place-items: center;
  border-radius: 50%;
  background: rgba(88, 166, 255, 0.14);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
}

.history-correction-item strong {
  color: var(--text);
}

.history-correction-item p {
  margin-top: 4px;
  color: var(--text3);
  font-size: 11px;
}

body.history-mode .workflow-section {
  display: none;
}

body.history-mode .history-section {
  display: block;
}

body:not(.history-mode) .history-section {
  display: none;
}

body.history-mode [data-tab="key"],
body.history-mode #keyPanel,
body.history-mode #lockedBanner {
  display: none;
}

body:not(.history-mode) [data-tab="summary"],
body:not(.history-mode) #summaryPanel {
  display: none;
}

.form-label {
  display: block;
  margin: 12px 0 6px;
  color: var(--text3);
  font-size: 11px;
}

.form-input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg3);
  color: var(--text);
  outline: none;
  padding: 7px 9px;
}

.form-input:focus {
  border-color: var(--border2);
}

.type-switch {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.type-option {
  min-height: 62px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg3);
  color: var(--text2);
  cursor: pointer;
  text-align: left;
  padding: 9px;
}

.type-option.active {
  border-color: var(--blue);
  background: rgba(31, 111, 235, 0.16);
  color: var(--text);
}

.type-option strong,
.type-option span {
  display: block;
}

.type-option span {
  margin-top: 4px;
  color: var(--text3);
  font-size: 11px;
}

.upload-area {
  position: relative;
  display: grid;
  min-height: 118px;
  place-items: center;
  border: 1.5px dashed var(--border2);
  border-radius: 8px;
  background: rgba(88, 166, 255, 0.05);
  cursor: pointer;
  text-align: center;
  padding: 16px;
}

.upload-area.drag {
  border-color: var(--blue);
  background: rgba(31, 111, 235, 0.2);
}

.upload-area.disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.upload-area.disabled input {
  cursor: not-allowed;
}

.upload-area input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-icon,
.upload-text,
.upload-hint {
  display: block;
}

.upload-icon {
  font-size: 22px;
}

.upload-text {
  margin-top: 6px;
  color: var(--text2);
}

.upload-hint {
  margin-top: 3px;
  color: var(--text3);
  font-size: 10px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 10px;
}

.thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg3);
}

.thumb-open {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.thumb-open:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

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

.thumb-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  cursor: pointer;
}

.image-preview {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview.hidden {
  display: none;
}

.image-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(6px);
}

.image-preview-panel {
  position: relative;
  width: min(92vw, 1080px);
  height: min(92vh, 820px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border2);
  border-radius: 8px;
  background: var(--bg2);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.55);
}

.image-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.image-preview-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.image-preview-counter {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text3);
}

.image-preview-close {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg3);
  color: var(--text2);
  cursor: pointer;
}

.image-preview-close:hover,
.image-preview-nav:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border2);
}

.image-preview-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 54px;
}

.image-preview-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
}

.image-preview-nav {
  position: absolute;
  top: 50%;
  width: 36px;
  height: 52px;
  transform: translateY(-50%);
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(13, 17, 23, 0.86);
  color: var(--text2);
  cursor: pointer;
  font-size: 30px;
  line-height: 1;
}

.image-preview-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.image-preview-nav.prev {
  left: 12px;
}

.image-preview-nav.next {
  right: 12px;
}

.action-btn,
.small-btn,
.chat-bar button {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: var(--blue2);
  color: #fff;
  cursor: pointer;
}

.action-btn {
  width: 100%;
  margin-top: 10px;
}

.action-btn.secondary,
.small-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
}

#confirmGradeButton:not(:disabled) {
  border: 0;
  background: var(--blue2);
  color: #fff;
}

.action-btn:disabled,
.chat-bar button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.badge,
.tab-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.14);
  color: var(--blue);
  font-size: 11px;
}

.badge.none,
.tab-badge.none {
  background: rgba(139, 148, 158, 0.12);
  color: var(--text3);
}

.badge.locked,
.tab-badge.locked {
  background: rgba(63, 185, 80, 0.16);
  color: var(--green);
}

.badge.warn,
.tab-badge.warn {
  background: rgba(210, 153, 34, 0.16);
  color: var(--yellow);
}

.right-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

body.role-locked .tabs,
body.role-locked .tab-panel,
body.role-locked .portal-agent-dock {
  display: none !important;
}

.role-gate {
  display: grid;
  min-height: 0;
  flex: 1;
  place-items: center;
  padding: 24px;
}

.role-gate.hidden {
  display: none;
}

.role-gate-card {
  width: min(100%, 480px);
  padding: 24px;
  border: 1px solid rgba(210, 153, 34, 0.32);
  border-radius: 8px;
  background: rgba(210, 153, 34, 0.08);
}

.role-gate-card h1 {
  margin-bottom: 10px;
}

.role-gate-card p {
  margin-bottom: 18px;
}

.role-gate-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(210, 153, 34, 0.42);
  border-radius: 8px;
  background: rgba(210, 153, 34, 0.12);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.role-gate-button:hover {
  border-color: var(--yellow);
}

.tabs {
  display: flex;
  min-height: 46px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
}

.tab.active {
  color: var(--text);
  background: rgba(88, 166, 255, 0.08);
}

.tab-panel {
  display: none;
  min-height: 0;
  overflow: hidden;
  flex: 1;
  flex-direction: column;
}

.tab-panel.active {
  display: flex;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

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

h1 {
  margin-bottom: 6px;
  font-size: 18px;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 15px;
  letter-spacing: 0;
}

p {
  margin-bottom: 0;
  color: var(--text2);
  line-height: 1.6;
}

.stream {
  overflow-y: auto;
  flex: 1;
  padding: 18px 20px;
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
}

.empty {
  display: grid;
  min-height: 360px;
  place-content: center;
  text-align: center;
}

.empty-icon {
  margin-bottom: 12px;
  font-size: 34px;
}

.locked-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(63, 185, 80, 0.28);
  background: rgba(63, 185, 80, 0.1);
  color: var(--green);
}

.locked-banner button {
  border: 1px solid rgba(63, 185, 80, 0.32);
  border-radius: 7px;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  padding: 5px 10px;
}

.hidden {
  display: none;
}

body.history-mode .history-section.hidden {
  display: block;
}

.grade-layout {
  display: flex;
  min-height: 0;
  overflow: hidden;
  flex: 1;
}

.student-sidebar {
  display: none;
  width: 140px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg2);
}

.student-sidebar.visible {
  display: block;
}

.student-sidebar-hd {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text3);
  font-size: 11px;
  font-weight: 700;
}

.student-item {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.student-item.clickable {
  cursor: pointer;
}

.student-item.clickable:hover {
  background: var(--bg3, #2a2a2a);
}

.student-item.selected {
  background: var(--accent, #2563eb22);
  color: var(--text1, #fff);
  font-weight: 600;
  border-left: 3px solid var(--accent-solid, #2563eb);
}

.si-icon {
  flex-shrink: 0;
  font-size: 11px;
  width: 14px;
  text-align: center;
  opacity: 0.7;
}

.si-confirmed {
  margin-left: auto;
  font-size: 10px;
  color: #4ade80;
  flex-shrink: 0;
}

.message {
  max-width: 880px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg2);
  padding: 14px;
}

.message-title {
  margin-bottom: 8px;
  color: var(--blue);
  font-weight: 700;
}

.message pre {
  overflow-x: auto;
  max-height: 420px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}

.message .meta-line {
  margin-top: 10px;
  color: var(--text3);
  font-size: 11px;
}

.course-context-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  color: var(--text3);
  font-size: 11px;
}

.course-context-line span {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.08);
  padding: 2px 8px;
}

.msg {
  display: flex;
  gap: 8px;
  animation: msgIn 0.2s ease;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg.user {
  flex-direction: row-reverse;
}

.msg-av {
  display: flex;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
}

.msg-av.assistant {
  background: linear-gradient(135deg, #1f6feb, #bc8cff);
  color: #fff;
}

.msg-av.assistant.green {
  background: linear-gradient(135deg, #2ea043, #3fb950);
}

.msg-av.user {
  border: 1px solid rgba(63, 185, 80, 0.3);
  background: rgba(63, 185, 80, 0.12);
  color: var(--green);
}

.msg-body {
  min-width: 0;
  flex: 1;
}

.msg.user .msg-body {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.msg-label {
  margin-bottom: 3px;
  color: var(--text3);
  font-size: 10px;
}

.msg-bubble {
  max-width: 100%;
  border-radius: 9px;
  padding: 14px 18px;
  font-size: 12px;
  line-height: 1.85;
}

.msg.assistant .msg-bubble {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 3px 9px 9px 9px;
  background: var(--bg3);
}

.msg.user .msg-bubble {
  max-width: 82%;
  border: 1px solid rgba(88, 166, 255, 0.2);
  border-radius: 9px 3px 9px 9px;
  background: rgba(31, 111, 235, 0.22);
  text-align: left;
}

.msg-bubble h1 {
  margin: 0 0 12px;
  border-bottom: 1px solid var(--border);
  color: var(--blue);
  font-size: 15px;
  font-weight: 700;
  padding-bottom: 8px;
}

.msg-bubble h2 {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 16px 0 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.msg-bubble h2::before {
  display: inline-block;
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: var(--blue2);
  content: "";
}

.msg-bubble h3 {
  margin: 10px 0 5px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
}

.msg-bubble strong {
  color: var(--text);
  font-weight: 600;
}

.msg-bubble em {
  color: var(--yellow);
  font-style: normal;
}

.msg-bubble code {
  border-radius: 3px;
  background: rgba(88, 166, 255, 0.12);
  font-family: monospace;
  font-size: 11px;
  padding: 1px 5px;
}

.msg-bubble table {
  width: 100%;
  margin: 8px 0 12px;
  border-collapse: collapse;
  font-size: 12px;
}

.msg-bubble th,
.msg-bubble td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  vertical-align: top;
}

.msg-bubble th {
  background: rgba(88, 166, 255, 0.08);
  color: var(--text);
}

.msg-bubble ul {
  margin: 5px 0;
  padding-left: 16px;
}

.typing-dots span {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--text2);
  animation: typingPulse 1s infinite ease-in-out;
}

.working-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text2);
}

.working-state .typing-dots {
  display: inline-flex;
  align-items: center;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typingPulse {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.chat-bar {
  z-index: 10;
  display: flex;
  flex-shrink: 0;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}

.chat-bar textarea {
  min-height: 40px;
  max-height: 90px;
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg3);
  color: var(--text);
  outline: none;
  padding: 9px;
}

.chat-bar button {
  width: 72px;
}

@media (max-width: 900px) {
  html,
  body {
    overflow: auto;
  }

  .main-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .left-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .right-panel {
    min-height: 680px;
  }

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

  .history-error-item dl div {
    grid-template-columns: 1fr;
  }
}

/* ── 异常学生匹配面板 ────────────────────────────────────────────── */
.student-item.unmatched {
  color: #fbbf24;
}

.match-panel {
  max-width: 520px;
  margin: 32px auto;
  padding: 24px;
  background: var(--bg2);
  border: 1px solid #fbbf2444;
  border-radius: 10px;
}

.match-panel-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #fbbf24;
}

.match-panel-hint {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 16px;
}

.match-panel-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.match-select {
  flex: 1;
  padding: 8px 10px;
  background: var(--bg3, #1a1a1a);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text1, #fff);
  font-size: 14px;
}

.match-panel-status {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text3);
  min-height: 18px;
}

/* ── 班级汇总视图 ────────────────────────────────────────────────── */
.summary-student-table-wrap {
  overflow-x: auto;
}

.summary-student-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.summary-student-table th,
.summary-student-table td {
  border: 1px solid var(--border);
  padding: 7px 10px;
  text-align: left;
}

.summary-student-table th {
  background: rgba(88, 166, 255, 0.08);
  color: var(--text2);
  font-weight: 600;
}

.summary-student-table td {
  color: var(--text2);
}

.summary-kp-list {
  display: grid;
  gap: 8px;
}

.summary-kp-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg3);
}

.summary-kp-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.summary-kp-main strong {
  color: var(--text);
}

.summary-kp-main span {
  color: var(--text3);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-kp-stats {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
}

.summary-kp-stats span {
  border-radius: 999px;
  background: rgba(88, 166, 255, 0.1);
  color: var(--blue);
  font-size: 10px;
  padding: 2px 7px;
  white-space: nowrap;
}
