:root {
  --bg: #eef4ff;
  --panel: #ffffff;
  --panel-soft: #f7f9fd;
  --ink: #1d2433;
  --muted: #657083;
  --line: #dbe3ef;
  --brand: #2f7df6;
  --brand-2: #28b7c8;
  --green: #2f9e64;
  --red: #e5484d;
  --amber: #d99022;
  --violet: #8a63e8;
  --shadow: 0 16px 38px rgba(32, 59, 95, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  -webkit-text-size-adjust: 100%;
  color: var(--ink);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.login-screen {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eaf1fb;
}

.login-panel {
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 30px;
  background: white;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 10px;
}

.login-brand h1 {
  margin: 0;
  font-size: 25px;
}

.login-panel label,
.profile-form label,
.analytics-controls label {
  display: grid;
  gap: 6px;
}

.login-panel label span,
.profile-form label span,
.analytics-controls label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.login-panel input,
.profile-form input,
.profile-form select,
.profile-form textarea,
.analytics-controls select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: white;
}

.login-submit {
  height: 44px;
  border: 0;
  border-radius: 6px;
  color: white;
  background: var(--brand);
  font-weight: 800;
}

.demo-accounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.demo-accounts button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 12px;
}

body.authenticated .login-screen {
  display: none;
}

body.auth-pending .app-shell {
  visibility: hidden;
}

.student-only {
  display: none;
}

body.student-mode .teacher-only,
body.student-mode .builder-panel,
body.student-mode .report-action {
  display: none;
}

body.student-mode .student-only {
  display: grid;
}

body.student-mode .app-shell {
  grid-template-columns: 76px minmax(0, 1fr);
}

.app-shell {
  display: grid;
  grid-template-columns: 76px 340px minmax(760px, 1fr);
  min-height: 100vh;
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
}

.brand {
  display: grid;
  gap: 6px;
  justify-items: center;
  font-size: 14px;
}

.bot-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, #315be8, #35c3d1);
  font-size: 12px;
  font-weight: 800;
}

.rail-nav {
  display: grid;
  gap: 14px;
  width: 100%;
}

.rail-item {
  display: grid;
  width: 48px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.rail-item.active,
.rail-item:hover {
  background: #eef5ff;
}

.icon,
.upload-icon,
.image-icon,
.bolt {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
}

.document-icon::before {
  position: absolute;
  inset: 2px 4px;
  content: "";
  border: 2px solid #293241;
  border-radius: 3px;
}

.document-icon::after {
  position: absolute;
  top: 6px;
  left: 8px;
  width: 8px;
  height: 2px;
  content: "";
  background: #293241;
  box-shadow: 0 5px 0 #293241;
}

.folder-icon::before {
  position: absolute;
  inset: 5px 2px 3px;
  content: "";
  border: 2px solid #293241;
  border-radius: 3px;
}

.folder-icon::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 9px;
  height: 5px;
  content: "";
  border: 2px solid #293241;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}

.check-icon::before {
  position: absolute;
  inset: 3px;
  content: "";
  border: 2px solid #293241;
  border-radius: 50%;
}

.check-icon::after {
  position: absolute;
  top: 9px;
  left: 7px;
  width: 8px;
  height: 4px;
  content: "";
  border-left: 2px solid #293241;
  border-bottom: 2px solid #293241;
  transform: rotate(-45deg);
}

.gear-icon::before {
  position: absolute;
  inset: 4px;
  content: "";
  border: 2px solid #293241;
  border-radius: 50%;
  box-shadow: 0 -7px 0 -5px #293241, 0 7px 0 -5px #293241, 7px 0 0 -5px #293241, -7px 0 0 -5px #293241;
}

.builder-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 20px 18px;
}

.builder-head h1,
.topbar h2,
.report-cover h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.builder-head p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.form-wide {
  grid-column: 1 / -1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

input,
select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
}

input[readonly] {
  color: #41516a;
  background: #f5f8fc;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-self: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.segmented button,
.tabs button {
  border: 0;
  color: var(--muted);
  background: transparent;
}

.segmented button {
  height: 38px;
  padding: 0 16px;
}

.segmented .active,
.tabs .active {
  color: var(--brand);
  background: white;
  font-weight: 700;
}

.upload-stack {
  display: grid;
  gap: 8px;
}

.upload-box {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 10px;
  border: 1px dashed #aebbd0;
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #fbfdff;
}

.upload-box.required {
  border-color: #8ab8ff;
}

.upload-box > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.upload-box small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-box small.missing,
.material-missing {
  color: var(--red);
}

.upload-icon::before,
.image-icon::before {
  position: absolute;
  inset: 1px;
  content: "";
  border-radius: 6px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.upload-icon::after {
  position: absolute;
  top: 5px;
  left: 8px;
  width: 5px;
  height: 10px;
  content: "";
  border-top: 2px solid white;
  border-left: 2px solid white;
  transform: rotate(45deg);
}

.image-icon::after {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 5px;
  height: 6px;
  content: "";
  background: white;
  clip-path: polygon(0 100%, 35% 20%, 58% 70%, 75% 35%, 100% 100%);
}

.ghost-btn,
.secondary-btn {
  height: 36px;
  border: 1px solid #bfd4ff;
  border-radius: 6px;
  color: var(--brand);
  background: #f5f9ff;
  font-weight: 700;
}

.upload-box .ghost-btn {
  width: 58px;
  height: 32px;
  padding: 0;
}

.file-list {
  display: grid;
  gap: 9px;
  max-height: 280px;
  overflow-y: auto;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.file-list h2 {
  margin: 0;
  font-size: 14px;
}

.material-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.material-list-head button {
  border: 0;
  padding: 2px 0;
  color: var(--red);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.file-list a {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list a,
.material-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.material-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  border-top: 1px solid #e7edf5;
  padding-top: 7px;
}

.material-row a {
  display: block;
  min-width: 0;
}

.material-preview-link {
  overflow: hidden;
  min-width: 0;
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-preview-link:hover {
  color: var(--brand);
}

.material-row > small {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.material-role {
  overflow: hidden;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-material {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 19px;
  line-height: 1;
}

.remove-material:hover {
  color: var(--red);
  background: #fff0f0;
}

.material-missing {
  margin: 0;
  font-size: 11px;
}

.file-list a small,
.material-summary strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.material-summary {
  padding: 7px 0;
  color: var(--muted);
  font-size: 12px;
}

.material-summary.uploaded {
  color: var(--green);
}

.loading-copy,
.error-copy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.file-list a:hover {
  color: var(--brand);
}

.primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  flex: 0 0 50px;
  border: 0;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, #5d68f5, #36bfd0);
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(47, 125, 246, 0.28);
}

.primary-btn:disabled {
  cursor: not-allowed;
  background: #aab7c8;
  box-shadow: none;
  opacity: 0.72;
}

.bolt::before {
  position: absolute;
  top: 1px;
  left: 6px;
  width: 8px;
  height: 18px;
  content: "";
  background: currentColor;
  clip-path: polygon(48% 0, 100% 0, 63% 42%, 100% 42%, 36% 100%, 47% 55%, 10% 55%);
}

.workspace {
  min-width: 0;
  padding: 20px 24px 40px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 20px;
  height: 74px;
  padding: 0 18px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

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

.topbar h2 {
  overflow-wrap: anywhere;
  font-size: 21px;
  line-height: 1.35;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.user-chip,
.read-only-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 700;
}

.logout-btn {
  height: 36px;
  border: 0;
  padding: 0 8px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.logout-btn:hover {
  color: var(--red);
}

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

.api-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f5f7fa;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.api-badge.connected {
  border-color: #afe0c4;
  background: #ecf9f1;
  color: #238653;
}

.api-badge.disconnected {
  border-color: #ffc7ca;
  background: #fff2f2;
  color: var(--red);
}

.secondary-btn {
  min-width: 96px;
  padding: 0 14px;
  white-space: nowrap;
}

.top-actions .user-chip {
  overflow: hidden;
  max-width: 170px;
  flex: 0 1 auto;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions .logout-btn {
  min-width: 44px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 18px 0;
}

.status-card {
  position: relative;
  display: grid;
  gap: 5px;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 14px 46px;
  background: var(--panel);
}

.status-card span {
  position: absolute;
  top: 17px;
  left: 15px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #b7c4d9;
}

.status-card.done span {
  border-color: var(--green);
  background: var(--green);
}

.status-card.done span::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 8px;
  height: 5px;
  content: "";
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg);
}

.status-card.active {
  border-color: #8ab8ff;
  box-shadow: 0 8px 22px rgba(47, 125, 246, 0.12);
}

.status-card.active span {
  border-color: var(--brand);
}

.status-card.error {
  border-color: #ffc7ca;
  background: #fff7f7;
}

.status-card.error span {
  border-color: var(--red);
  background: var(--red);
}

.status-card small {
  color: var(--muted);
}

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

.preview-pane,
.review-pane,
.report-sheet {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.preview-pane,
.review-pane {
  padding: 16px;
}

.panel-title,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fit-control {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.fit-control button {
  height: 32px;
  border: 0;
  padding: 0 9px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.fit-control button.active {
  color: var(--brand);
  background: white;
  font-weight: 800;
}

.panel-title h3,
.report-section h3 {
  margin: 0;
  font-size: 17px;
}

.tabs {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.tabs button {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.preview-frame {
  position: relative;
  display: grid;
  place-items: center;
  height: 410px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #f2f6fc;
}

.preview-frame img {
  display: block;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
}

.preview-frame.fit-page {
  overflow: hidden;
}

.preview-frame.fit-page img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-position: center;
  cursor: zoom-in;
}

.preview-frame.fit-width {
  place-items: start center;
  overflow: auto;
}

.preview-frame.fit-width img {
  width: 100%;
  height: auto;
  max-width: none;
  max-height: none;
}

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

.thumb-nav {
  position: absolute;
  z-index: 2;
  top: calc(50% - 21px);
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.84);
  font-size: 28px;
}

.thumb-nav:first-of-type {
  left: 12px;
}

.thumb-nav:last-of-type {
  right: 12px;
}

.thumb-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-top: 12px;
}

.thumb-row button {
  flex: 0 0 66px;
  height: 46px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 0;
  background: #eef4ff;
}

.thumb-row button.active {
  border-color: var(--brand);
}

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

.review-list {
  display: grid;
  gap: 10px;
  max-height: 492px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.review-item {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.review-item header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.review-item header > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.review-item header > div small {
  color: var(--muted);
  font-size: 11px;
}

.review-item strong {
  font-size: 14px;
}

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

.review-item > small {
  display: block;
  color: #8a6a32;
  font-size: 11px;
  font-weight: 700;
}

.review-item.reviewed {
  border-color: #bde4cd;
  background: #f8fcfa;
}

.review-detail {
  gap: 12px;
  padding: 14px;
}

.review-reason,
.question-summary,
.review-guidance {
  margin: 0;
}

.review-location {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  color: var(--muted);
  font-size: 11px;
}

.review-location button {
  flex: 0 0 auto;
  border: 0;
  padding: 2px 0;
  color: var(--brand);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}

.question-summary {
  color: var(--ink) !important;
  font-weight: 700;
}

.answer-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.answer-compare > div {
  min-width: 0;
  padding: 10px;
}

.answer-compare > div + div {
  border-left: 1px solid var(--line);
}

.answer-compare span,
.score-review-control label > span:first-child {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.answer-compare p {
  margin: 5px 0 0;
  color: var(--ink);
  word-break: break-word;
}

.difference-list {
  display: grid;
}

.difference-row {
  border-bottom: 1px solid var(--line);
  padding: 10px 2px 10px 10px;
}

.difference-row.match {
  border-left: 3px solid var(--green);
}

.difference-row.mismatch,
.difference-row.missing {
  border-left: 3px solid var(--red);
}

.difference-row.partial,
.difference-row.uncertain {
  border-left: 3px solid var(--amber);
}

.difference-head,
.review-submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.difference-head strong {
  font-size: 12px;
}

.difference-head span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.difference-row.match .difference-head span {
  color: var(--green);
}

.difference-row.mismatch .difference-head span,
.difference-row.missing .difference-head span {
  color: var(--red);
}

.difference-row.partial .difference-head span,
.difference-row.uncertain .difference-head span {
  color: var(--amber);
}

.difference-answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 7px 0;
}

.difference-answers p {
  margin: 0;
  font-size: 11px;
  word-break: break-word;
}

.difference-answers b {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
}

.difference-row > small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.review-guidance {
  border-left: 3px solid var(--amber);
  padding-left: 9px;
  color: #765423 !important;
}

.score-review-control {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.score-review-control label {
  gap: 5px;
}

.score-input-wrap {
  display: grid;
  grid-template-columns: 82px auto;
  align-items: center;
  gap: 8px;
}

.score-input-wrap input {
  height: 36px;
  border-color: #9fc1f7;
  color: var(--brand);
  font-weight: 800;
}

.score-input-wrap b {
  color: var(--muted);
  font-size: 12px;
}

.review-note-field textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink);
  background: white;
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
}

.review-submit span {
  color: var(--muted);
  font-size: 11px;
}

.review-submit button {
  height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  color: white;
  background: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.review-submit button:disabled {
  opacity: 0.6;
}

.empty-state,
.table-empty {
  color: var(--muted);
  text-align: center;
}

.empty-state {
  padding: 36px 16px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  font-size: 13px;
}

.review-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.review-actions button {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}

.review-actions button:hover {
  color: var(--brand);
  border-color: #9cc2ff;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.pill.good {
  color: var(--green);
  background: #e8f6ef;
  border: 1px solid #bde4cd;
}

.pill.warning {
  color: var(--amber);
  background: #fff5df;
  border: 1px solid #f1d89f;
}

.pill.bad {
  color: var(--red);
  background: #ffeded;
  border: 1px solid #f3a4a8;
}

.report-sheet {
  width: min(100%, 980px);
  margin: 22px auto 0;
  padding: 28px;
}

.report-cover {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
}

.report-cover p {
  max-width: 650px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.score-card {
  display: grid;
  align-content: center;
  justify-items: center;
  width: 136px;
  min-width: 136px;
  border-radius: var(--radius);
  color: white;
  background: linear-gradient(145deg, #2f7df6, #2f9e64);
}

.score-card strong {
  font-size: 42px;
  line-height: 1;
}

.score-card span {
  margin-top: 8px;
  font-size: 12px;
  text-align: center;
}

.score-card.pending {
  background: #edf1f6;
  color: var(--muted);
}

.risk-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 3px solid #e7a33a;
  background: #fff9ee;
  color: #765423 !important;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.metrics div {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel-soft);
}

.metrics strong {
  color: var(--brand);
  font-size: 28px;
}

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

.score-breakdown-panel {
  margin: 4px 0 24px;
}

.score-breakdown-panel h3 {
  margin: 0;
  font-size: 15px;
}

.score-breakdown-panel table {
  table-layout: fixed;
}

.score-breakdown-value {
  color: var(--brand);
  font-size: 18px;
  font-weight: 800;
}

.report-section {
  margin-top: 24px;
}

.report-section p {
  line-height: 1.8;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f0f5fb;
  font-weight: 800;
  white-space: nowrap;
}

tbody tr:nth-child(even) {
  background: #fafcff;
}

.overall-analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 18px;
}

.overall-copy,
.overall-breakdown {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfe;
}

.overall-copy h4,
.overall-error-types strong {
  margin: 0 0 8px;
  font-size: 14px;
}

.overall-copy > p:not(.risk-note) {
  margin: 0;
}

.overall-result-counts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.overall-result-counts span {
  display: grid;
  gap: 3px;
  border-top: 3px solid var(--line);
  padding: 8px;
  color: var(--muted);
  background: white;
  font-size: 11px;
  text-align: center;
}

.overall-result-counts strong {
  color: var(--ink);
  font-size: 22px;
}

.overall-result-counts .correct { border-color: var(--green); }
.overall-result-counts .wrong { border-color: var(--red); }
.overall-result-counts .review { border-color: var(--amber); }

.overall-breakdown dl {
  display: grid;
  gap: 0;
  margin: 12px 0;
}

.overall-breakdown dl div {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 7px 0;
  font-size: 12px;
}

.overall-breakdown dt {
  color: var(--muted);
}

.overall-breakdown dd {
  margin: 0;
  font-weight: 700;
}

.overall-error-types > div {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.overall-error-types span {
  border: 1px solid #f0c9cb;
  border-radius: 4px;
  padding: 4px 6px;
  color: #a9373c;
  background: #fff5f5;
  font-size: 10px;
}

.question-section-head {
  align-items: flex-end;
}

.question-section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.question-filters {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.question-filters button {
  height: 34px;
  border: 0;
  border-left: 1px solid var(--line);
  padding: 0 11px;
  color: var(--muted);
  background: white;
  font-size: 12px;
}

.question-filters button:first-child {
  border-left: 0;
}

.question-filters button.active {
  color: white;
  background: var(--brand);
  font-weight: 800;
}

.question-overview {
  display: grid;
  grid-template-columns: repeat(20, minmax(30px, 1fr));
  gap: 5px;
  margin-bottom: 12px;
}

.question-overview button {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: white;
  font-size: 11px;
  font-weight: 800;
}

.question-overview button.correct {
  border-color: #a8d8bd;
  color: var(--green);
  background: #f1faf5;
}

.question-overview button.wrong {
  border-color: #efb5b8;
  color: var(--red);
  background: #fff1f2;
}

.question-overview button.review {
  border-color: #edd39f;
  color: #a96c10;
  background: #fff8e8;
}

.question-overview button.active {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.question-workbench {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.28fr);
  min-height: 610px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.question-list {
  max-height: 700px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #f8fafc;
}

.question-list-item {
  display: grid;
  width: 100%;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: start;
  gap: 9px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-left: 4px solid var(--line);
  padding: 12px 10px 12px 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.question-list-item:hover,
.question-list-item.active {
  background: white;
}

.question-list-item.active {
  box-shadow: inset 0 0 0 2px #b9d5ff;
}

.question-list-item.correct { border-left-color: var(--green); }
.question-list-item.wrong { border-left-color: var(--red); }
.question-list-item.review { border-left-color: var(--amber); }
.question-list-item.filtered-out { display: none; }

.question-list-number {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 5px;
  color: white;
  background: #7b8798;
  font-size: 12px;
  font-weight: 800;
}

.question-list-item.correct .question-list-number { background: var(--green); }
.question-list-item.wrong .question-list-number { background: var(--red); }
.question-list-item.review .question-list-number { background: var(--amber); }

.question-list-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.question-list-main strong,
.question-list-main small,
.question-list-main em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.question-list-main strong {
  font-size: 12px;
}

.question-list-main small {
  color: var(--muted);
  font-size: 11px;
}

.question-list-main em {
  color: #7a8493;
  font-size: 10px;
  font-style: normal;
}

.question-status {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.question-status.correct { border-color: #b7dec8; color: var(--green); background: #eef9f3; }
.question-status.wrong { border-color: #f0b9bc; color: var(--red); background: #fff1f2; }
.question-status.review { border-color: #edd39f; color: #a96c10; background: #fff8e8; }

.question-detail {
  min-width: 0;
  padding: 20px;
}

.question-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.question-detail-head h4 {
  margin: 4px 0 0;
  font-size: 16px;
  line-height: 1.55;
}

.question-kicker {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.question-meta span {
  border-right: 1px solid var(--line);
  padding-right: 7px;
  color: var(--muted);
  font-size: 11px;
}

.question-meta span:last-child {
  border-right: 0;
}

.question-answer-compare {
  margin-top: 0;
}

.question-analysis-copy,
.question-review-evidence {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 15px;
}

.question-analysis-copy h5,
.question-review-evidence h5 {
  margin: 0 0 7px;
  font-size: 14px;
}

.question-analysis-copy > p:last-child {
  margin: 0;
  color: #4e596a;
}

.question-error-type {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}

.question-error-type strong {
  color: var(--red);
  font-size: 11px;
}

.question-error-type span {
  border-radius: 4px;
  padding: 3px 6px;
  color: #9d3439;
  background: #fff0f1;
  font-size: 11px;
}

.detail-section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.detail-section-title button {
  flex: 0 0 auto;
  border: 1px solid #a9caff;
  border-radius: 5px;
  padding: 6px 9px;
  color: var(--brand);
  background: #f5f9ff;
  font-size: 11px;
  font-weight: 800;
}

.question-score-summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 8px;
  border-left: 3px solid var(--amber);
  padding: 8px 10px;
  color: var(--muted);
  background: #fffaf0;
  font-size: 11px;
}

.question-score-summary strong {
  color: var(--ink);
}

.question-detail-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.question-detail-nav span {
  color: var(--muted);
  font-size: 11px;
}

.question-detail-nav button {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 6px 10px;
  color: var(--ink);
  background: white;
  font-size: 11px;
}

.question-detail-nav button:disabled {
  cursor: default;
  opacity: 0.45;
}

.question-row td {
  transition: background 120ms ease;
}

.question-row.is-correct td {
  background: #f5fbf7;
}

.question-row.is-wrong td {
  border-top-color: #f1b7ba;
  border-bottom-color: #f1b7ba;
  background: #fff3f3;
}

.question-row.is-partial td {
  background: #fffaf0;
}

.question-row.is-correct td:first-child {
  box-shadow: inset 4px 0 0 var(--green);
}

.question-row.is-wrong td:first-child {
  box-shadow: inset 4px 0 0 var(--red);
}

.question-row.is-partial td:first-child {
  box-shadow: inset 4px 0 0 var(--amber);
}

.question-row.is-wrong .student-answer {
  color: var(--red);
  font-weight: 800;
}

.question-row.is-wrong .reference-answer,
.question-row.is-correct .student-answer {
  color: var(--green);
  font-weight: 800;
}

.analysis-cell {
  min-width: 300px;
}

.analysis-cell span {
  display: block;
  line-height: 1.65;
}

.error-type {
  display: inline-block;
  margin-bottom: 5px;
  color: var(--red);
  font-size: 11px;
}

.bar-chart {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.bar-chart div {
  display: grid;
  grid-template-columns: 120px 1fr 76px;
  align-items: center;
  gap: 12px;
}

.bar-chart b {
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf5;
}

.bar-chart b::before {
  display: block;
  width: calc(var(--score) / var(--full) * 100%);
  height: 100%;
  content: "";
  background: linear-gradient(90deg, var(--brand), var(--green));
}

.bar-chart em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.two-col {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
}

.ability-method {
  display: grid;
  gap: 5px;
  margin: 8px 0 14px;
  border-left: 3px solid var(--brand);
  padding: 8px 10px;
  color: var(--muted);
  background: #f6f9fd;
  font-size: 11px;
  line-height: 1.55;
}

.ability-method strong {
  color: var(--ink);
}

.ability-method small {
  color: var(--amber);
}

.radar-lite {
  display: grid;
  gap: 14px;
}

.ability-item {
  display: grid;
  gap: 7px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.ability-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.ability-meter {
  display: grid;
  grid-template-columns: 92px 1fr 30px;
  align-items: center;
  gap: 10px;
}

.ability-meter em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  text-align: right;
}

.ability-meter b {
  overflow: hidden;
  height: 14px;
  border-radius: 999px;
  background: #e8edf5;
}

.ability-meter b::before {
  display: block;
  width: calc(var(--value) * 1%);
  height: 100%;
  content: "";
  border-radius: inherit;
  background: linear-gradient(90deg, #37a2ff, #73c66d);
}

.ability-item p {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 7px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.ability-item p strong {
  color: var(--ink);
}

.ability-item p i {
  border: 1px solid #f1d89f;
  border-radius: 4px;
  padding: 0 4px;
  color: var(--amber);
  background: #fff8e8;
  font-style: normal;
}

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

.advice-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel-soft);
}

.advice-grid h4 {
  margin: 0 0 8px;
}

.advice-grid p {
  margin: 0;
  color: var(--muted);
}

.advice-list p + p {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.answer-cell {
  max-width: 260px;
  word-break: break-word;
}

.compact-table {
  margin-top: 8px;
}

.report-boundary {
  border-top: 1px dashed var(--line);
  background: #fbfcfe;
}

.report-boundary p {
  color: var(--muted);
  font-size: 12px;
}

.management-view {
  display: none;
  margin-top: 18px;
}

.workspace[data-view="students"] > .status-strip,
.workspace[data-view="students"] > .main-grid,
.workspace[data-view="students"] > .report-sheet,
.workspace[data-view="analytics"] > .status-strip,
.workspace[data-view="analytics"] > .main-grid,
.workspace[data-view="analytics"] > .report-sheet,
.workspace[data-view="portal"] > .status-strip,
.workspace[data-view="portal"] > .main-grid,
.workspace[data-view="portal"] > .report-sheet {
  display: none;
}

.workspace[data-view="students"] .report-action,
.workspace[data-view="analytics"] .report-action,
.workspace[data-view="portal"] .report-action {
  display: none;
}

.workspace[data-view="students"] #studentsView,
.workspace[data-view="analytics"] #analyticsView,
.workspace[data-view="portal"] #portalView {
  display: block;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  padding: 4px 2px 18px;
}

.view-header h2,
.analytics-heading h3,
.portal-report h3 {
  margin: 0;
}

.view-stats {
  display: flex;
  gap: 8px;
}

.view-stats span {
  display: grid;
  min-width: 90px;
  gap: 2px;
  border-left: 2px solid var(--line);
  padding-left: 10px;
  color: var(--muted);
  font-size: 11px;
}

.view-stats strong {
  color: var(--ink);
  font-size: 20px;
}

.management-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.profile-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: white;
}

.profile-form .section-head {
  grid-column: 1 / -1;
}

.profile-form .section-head span,
.data-region .section-head span,
.analytics-heading > span {
  color: var(--muted);
  font-size: 12px;
}

.profile-form .form-wide {
  grid-column: 1 / -1;
}

.profile-form [hidden] {
  display: none;
}

.profile-form textarea {
  resize: vertical;
}

.profile-form .primary-btn {
  height: 42px;
}

.data-region,
.analytics-result,
.portal-report {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: white;
}

.row-actions {
  white-space: nowrap;
}

.row-actions button,
.data-region td button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 9px;
  color: var(--brand);
  background: white;
  font-size: 12px;
}

.row-actions button + button {
  margin-left: 5px;
}

.analytics-controls {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 18px;
  margin: 20px 0;
}

.analytics-controls > div {
  display: flex;
  align-items: end;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 0 0 16px;
}

.analytics-controls label {
  flex: 1;
}

.analytics-controls button {
  flex: 0 0 auto;
  height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  color: white;
  background: var(--brand);
  font-weight: 700;
}

.analytics-result {
  min-height: 320px;
}

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

.analytics-bars {
  display: grid;
  gap: 13px;
  margin: 0 0 24px;
}

.analytics-bar {
  display: grid;
  grid-template-columns: minmax(150px, 0.45fr) minmax(180px, 1fr) 58px;
  align-items: center;
  gap: 14px;
}

.analytics-bar > div {
  display: grid;
  gap: 3px;
}

.analytics-bar span {
  color: var(--muted);
  font-size: 11px;
}

.analytics-bar b {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf5;
}

.analytics-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--green));
}

.analytics-bar em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  text-align: right;
}

.subsection-title {
  margin: 24px 0 16px;
  font-size: 16px;
}

.read-only-badge {
  border-color: #afe0c4;
  color: var(--green);
  background: #ecf9f1;
}

.portal-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.portal-summary > div {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: white;
}

.portal-summary strong {
  color: var(--brand);
  font-size: 28px;
}

.portal-summary small {
  color: var(--muted);
}

.portal-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.72fr) minmax(560px, 1.28fr);
  align-items: start;
  gap: 18px;
}

.portal-report {
  display: grid;
  gap: 18px;
}

.portal-report > header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.portal-report > header p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.portal-score {
  display: flex;
  align-items: baseline;
  gap: 3px;
  color: var(--brand);
}

.portal-score strong {
  font-size: 36px;
}

.portal-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.portal-metrics span {
  border-left: 3px solid var(--line);
  padding: 4px 12px;
  color: var(--muted);
  font-size: 12px;
}

.portal-metrics strong {
  margin-right: 4px;
  color: var(--ink);
}

.portal-score-breakdown {
  margin-bottom: 16px;
}

.portal-materials {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  font-size: 12px;
}

.portal-materials a {
  color: var(--brand);
  text-decoration: none;
}

body.lightbox-open {
  overflow: hidden;
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: block;
  padding: 0;
  background: #101722;
}

.lightbox-dialog {
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #101722;
}

.lightbox-dialog > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 14px 0 18px;
  color: white;
  background: #202b3a;
}

.lightbox-dialog > header > div:first-child {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 10px;
}

.lightbox-dialog > header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-dialog > header span {
  flex: 0 0 auto;
  color: #b8c4d4;
  font-size: 12px;
}

.lightbox-tools {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
}

.lightbox-tools button {
  display: grid;
  width: 38px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  color: white;
  background: transparent;
  font-size: 21px;
}

.lightbox-tools button:hover {
  background: #354256;
}

.lightbox-viewport {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #111821;
  cursor: default;
  touch-action: none;
}

.lightbox-viewport img {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100% - 132px);
  max-height: calc(100% - 48px);
  transform: translate(-50%, -50%);
  transform-origin: center;
  cursor: grab;
  user-select: none;
  will-change: transform;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.38);
}

.lightbox-viewport.dragging img {
  cursor: grabbing;
}

.lightbox-nav {
  position: absolute;
  z-index: 2;
  top: calc(50% - 25px);
  display: grid;
  width: 46px;
  height: 50px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: white;
  background: rgba(44, 56, 73, 0.78);
  font-size: 32px;
}

.lightbox-nav.previous {
  left: 18px;
}

.lightbox-nav.next {
  right: 18px;
}

.lightbox-nav:hover {
  background: var(--brand);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 32px));
  padding: 11px 14px;
  border: 1px solid #afe0c4;
  border-radius: 6px;
  background: #ecf9f1;
  color: #238653;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(24, 48, 76, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.bad {
  border-color: #ffc7ca;
  background: #fff2f2;
  color: var(--red);
}

[contenteditable="true"] {
  outline: 2px solid transparent;
  outline-offset: 3px;
}

[contenteditable="true"]:focus {
  border-radius: 4px;
  outline-color: #a9ccff;
  background: #fbfdff;
}

@media (max-width: 1280px) {
  body {
    min-width: 0;
  }

  .app-shell {
    grid-template-columns: 64px 300px minmax(0, 1fr);
  }

  .rail {
    padding-right: 8px;
    padding-left: 8px;
  }

  .builder-panel {
    padding-right: 14px;
    padding-left: 14px;
  }

  .workspace {
    padding: 14px 16px 32px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    height: auto;
    min-height: 112px;
    padding: 13px 16px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-end;
  }

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

  .main-grid,
  .overall-analysis-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .question-overview {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }

  .review-list {
    max-height: 720px;
  }
}

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .app-shell {
    display: block;
  }

  .rail {
    display: none;
  }

  .builder-panel {
    position: static;
    height: auto;
    overflow: visible;
    border-right: 0;
  }

  .workspace {
    padding: 14px;
  }

  .topbar,
  .report-cover {
    align-items: flex-start;
    flex-direction: column;
    height: auto;
    padding: 16px;
  }

  .status-strip,
  .main-grid,
  .metrics,
  .two-col,
  .advice-grid,
  .overall-analysis-grid,
  .management-grid,
  .analytics-controls,
  .portal-layout {
    grid-template-columns: 1fr;
  }

  .question-section-head,
  .detail-section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .question-filters {
    width: 100%;
  }

  .question-filters button {
    flex: 1 1 0;
    padding: 0 5px;
  }

  .question-overview {
    grid-template-columns: repeat(10, 1fr);
  }

  .question-workbench {
    grid-template-columns: 1fr;
  }

  .question-list {
    max-height: 390px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .question-detail {
    padding: 15px;
  }

  .view-header,
  .analytics-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .view-stats,
  .top-actions {
    flex-wrap: wrap;
  }

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

  .analytics-controls > div {
    align-items: stretch;
    flex-direction: column;
  }

  .analytics-bar {
    grid-template-columns: minmax(120px, 0.6fr) 1fr 48px;
  }

  .portal-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .preview-frame {
    height: 310px;
  }

  .panel-title,
  .preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .review-list {
    max-height: none;
    overflow: visible;
  }

  .answer-compare,
  .difference-answers {
    grid-template-columns: 1fr;
  }

  .answer-compare > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .report-sheet {
    padding: 18px;
  }

  .login-panel {
    padding: 22px;
  }

  .image-lightbox {
    padding: 0;
  }

  .lightbox-dialog {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }

  .lightbox-dialog > header {
    padding-left: 12px;
  }

  .lightbox-dialog > header strong {
    max-width: 110px;
  }

  .lightbox-viewport img {
    max-width: calc(100% - 80px);
    max-height: calc(100% - 24px);
  }

  .lightbox-nav.previous {
    left: 4px;
  }

  .lightbox-nav.next {
    right: 4px;
  }
}

@media print {
  body {
    min-width: 0;
    background: white;
  }

  .rail,
  .builder-panel,
  .topbar,
  .status-strip,
  .main-grid {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .workspace {
    padding: 0;
  }

  .report-sheet {
    width: auto;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .question-filters,
  .question-overview,
  .question-detail {
    display: none !important;
  }

  .question-workbench {
    display: block;
    min-height: 0;
    border: 0;
  }

  .question-list {
    max-height: none;
    overflow: visible;
    border: 0;
  }

  .question-list-item,
  .question-list-item.filtered-out {
    display: grid;
    break-inside: avoid;
    background: white;
  }
}
