:root {
  color-scheme: light;
  --bg: #eef2f3;
  --surface: #ffffff;
  --surface-soft: #f7f9fa;
  --border: #d8e0e4;
  --text: #182229;
  --muted: #667681;
  --primary: #235f73;
  --primary-dark: #174657;
  --accent: #4e7d46;
  --warn: #ad6b24;
  --danger: #ad3e3e;
  --shadow: 0 12px 32px rgba(24, 34, 41, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 18px;
  background: #17262d;
  color: #f7fbfc;
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #f5c96a;
  color: #17262d;
  font-weight: 800;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 3px;
  color: #a8bac1;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #d7e3e7;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: #233942;
  border-color: #3b5660;
  color: #ffffff;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.portal-switcher {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.portal-switcher a {
  padding: 7px 4px;
  border: 1px solid #35505a;
  border-radius: 6px;
  color: #c7d7dc;
  font-size: 12px;
  text-align: center;
  text-decoration: none;
}

.portal-switcher a:hover,
.portal-switcher a[aria-current="page"] {
  border-color: #f5c96a;
  color: #ffffff;
}

.server-state {
  padding: 10px;
  border: 1px solid #35505a;
  border-radius: 6px;
  color: #c7d7dc;
  font-size: 13px;
}

.server-state.ok {
  border-color: #668b5f;
  color: #dff2d8;
}

.server-state.bad {
  border-color: #9d5b5b;
  color: #f5d8d8;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.25;
}

h2 {
  font-size: 17px;
}

.topbar p,
.login-form p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.user-area {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  white-space: nowrap;
}

.login-panel {
  display: grid;
  min-height: calc(100vh - 160px);
  place-items: center;
}

.login-form,
.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-form {
  display: grid;
  width: min(430px, 100%);
  gap: 16px;
  padding: 24px;
}

.workspace {
  display: grid;
  gap: 18px;
}

.metric-grid,
.profile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 128px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card span,
.metric-card small {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  font-size: 28px;
  line-height: 1.1;
}

.teacher-control-panel,
.teacher-assignment-form {
  margin-bottom: 18px;
}

.teacher-filter-row,
.teacher-admin-row,
.inline-form,
.assignment-form-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.teacher-filter-row,
.teacher-admin-row,
.assignment-form-grid {
  padding: 16px;
}

.teacher-filter-row label {
  min-width: 180px;
  flex: 1 1 200px;
}

.teacher-admin-row {
  padding-top: 0;
  border-top: 1px solid var(--border);
}

.inline-form {
  flex: 1 1 420px;
}

.inline-form input {
  min-width: 150px;
  flex: 1 1 160px;
}

.admin-user-create-form {
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.admin-user-create-form label {
  min-width: 150px;
  flex: 1 1 170px;
}

.teacher-overview-grid {
  margin-bottom: 18px;
}

.compact-stat-list,
.review-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.compact-stat-row,
.review-card,
.roster-row,
.admin-user-row,
.config-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.compact-stat-row {
  grid-template-columns: minmax(100px, 0.55fr) minmax(100px, 1fr) auto;
  align-items: center;
}

.compact-stat-row progress {
  width: 100%;
  accent-color: var(--primary);
}

.review-card-header,
.review-card-meta,
.review-actions,
.roster-row,
.admin-user-row,
.config-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.review-card-meta {
  justify-content: flex-start;
  color: var(--muted);
  font-size: 12px;
}

.review-card blockquote {
  margin: 0;
  padding-left: 12px;
  border-left: 3px solid #9ac2ba;
  color: #31444a;
  line-height: 1.7;
  white-space: pre-wrap;
}

.review-card textarea {
  width: 100%;
  min-height: 92px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
}

.review-actions button,
.roster-row button,
.admin-user-row button,
.config-row button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.linkish-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.assignment-form-grid label {
  flex: 1 1 210px;
}

.assignment-form-grid .assignment-requirement-picker {
  display: grid;
  width: 100%;
  flex-basis: 100%;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.assignment-requirement-heading,
.assignment-unit-title,
.assignment-behavior-option,
.assignment-behavior-option > span {
  display: flex;
  gap: 8px;
  align-items: center;
}

.assignment-requirement-heading {
  justify-content: space-between;
}

.assignment-requirement-heading > div:first-child,
.assignment-unit-title {
  display: grid;
  gap: 3px;
}

.assignment-requirement-heading span,
.assignment-unit-title span,
.assignment-behavior-option small {
  color: var(--muted);
  font-size: 12px;
}

.assignment-requirement-list {
  display: grid;
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.assignment-requirement-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(0, 1.8fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.assignment-requirement-row:last-child {
  border-bottom: 0;
}

.assignment-behavior-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.assignment-behavior-option {
  display: grid;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
}

.assignment-behavior-option input {
  width: auto;
  min-height: auto;
}

.assignment-behavior-option select {
  width: 100%;
  min-width: 0;
  font-size: 12px;
}

.assignment-behavior-option.is-unavailable {
  opacity: 0.5;
}

.assignment-mode-badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.assignment-mode-badge.is-comprehensive {
  background: #eff6ff;
  color: #1d4ed8;
}

.assignment-snapshot-preview summary {
  cursor: pointer;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.assignment-snapshot-preview ol {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding-left: 22px;
}

.assignment-snapshot-preview li span {
  margin-right: 8px;
  color: var(--muted);
  font-size: 12px;
}

.behavior-fieldset {
  display: flex;
  flex: 1 1 100%;
  gap: 18px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.behavior-fieldset legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.behavior-fieldset label {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  align-items: center;
}

.behavior-fieldset input {
  min-height: auto;
}

.diagnosis-section {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.diagnosis-timeline {
  display: grid;
  gap: 10px;
}

.diagnosis-timeline article {
  padding: 12px;
  border-left: 3px solid #86aea6;
  background: var(--surface-soft);
}

.status-pill {
  display: inline-flex;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e7f1ef;
  color: #246157;
  font-size: 12px;
}

.status-pill.warn {
  background: #fff4e5;
  color: #8b561d;
}

.status-pill.danger {
  background: #fdeaea;
  color: #9b3838;
}

.config-create-form {
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.portal-entry-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-action {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.dashboard-action:hover strong {
  color: var(--primary);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

input,
select {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
}

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

label input,
label select {
  color: var(--text);
  font-size: 14px;
}

.primary-button,
.secondary-button {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-button {
  background: var(--primary);
  color: #ffffff;
}

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

.secondary-button {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text);
}

.secondary-button:hover {
  border-color: #a8bac1;
}

.full {
  width: 100%;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 18px;
}

.split-layout.relaxed {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.6fr);
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.card-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.list-card {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

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

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

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

td:nth-child(2),
td:nth-child(3),
td:nth-child(4) {
  white-space: nowrap;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-button {
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e7edf0;
  color: #43545d;
  font-size: 12px;
  font-weight: 700;
}

.status.draft {
  background: #e8eef0;
}

.status.pending_review {
  background: #fff0d9;
  color: var(--warn);
}

.status.published {
  background: #e4f0df;
  color: var(--accent);
}

.status.rejected {
  background: #f5dddd;
  color: var(--danger);
}

.detail-panel {
  min-height: 520px;
}

.book-summary {
  padding: 14px;
}

.summary-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.summary-list > div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.summary-list > .dashboard-action {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--border);
}

.summary-list > div:last-child,
.summary-list > .dashboard-action:last-child {
  border-bottom: 0;
}

.summary-list strong {
  font-size: 13px;
}

.summary-list span {
  color: #3b4850;
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 42px 18px;
  color: var(--muted);
  text-align: center;
}

.unit-list {
  display: grid;
  gap: 12px;
  max-height: 640px;
  overflow: auto;
  padding: 14px;
}

.unit-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.unit-item:hover {
  border-color: #9eb5bd;
}

.unit-title {
  font-weight: 800;
}

.unit-text {
  display: -webkit-box;
  overflow: hidden;
  color: #3b4850;
  font-size: 13px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 3px 7px;
  border-radius: 999px;
  background: #e8f0f2;
  color: var(--primary);
  font-size: 12px;
}

.task-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.task-mini span {
  padding: 3px 7px;
  border-radius: 6px;
  background: #f4f0e6;
  color: #71551d;
  font-size: 12px;
}

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

.form-panel {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.form-panel .panel-header {
  margin: 0 -18px;
}

.form-panel.compact {
  max-width: 620px;
}

.checkbox-line {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
}

.checkbox-line input {
  min-height: auto;
}

.review-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.runtime-strategy-panel {
  align-content: start;
}

.runtime-strategy-report {
  display: grid;
  gap: 10px;
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.runtime-review-panel {
  margin-top: 18px;
}

.runtime-review-panel .panel-header > div {
  display: grid;
  gap: 4px;
}

.runtime-review-panel .form-note {
  margin: 0;
}

.runtime-review-item {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
}

.runtime-review-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.runtime-review-heading > div {
  min-width: 0;
}

.runtime-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.runtime-metric-grid > div {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.runtime-metric-grid span {
  color: var(--muted);
  font-size: 11px;
}

.runtime-metric-grid strong {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-success,
.runtime-error,
.runtime-progress {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
}

.runtime-success {
  background: #ecfdf5;
  color: #047857;
}

.runtime-error {
  background: #fef2f2;
  color: #b91c1c;
}

.runtime-progress {
  background: #eff6ff;
  color: #1d4ed8;
}

.runtime-file {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
}

.runtime-review-item .primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.status.runtime-not_generated {
  background: #f4f4f5;
  color: #52525b;
}

.status.runtime-candidate {
  background: #fffbeb;
  color: #b45309;
}

.status.runtime-active {
  background: #ecfdf5;
  color: #047857;
}

.status.runtime-invalid {
  background: #fef2f2;
  color: #b91c1c;
}

.review-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

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

.book-card {
  display: grid;
  gap: 12px;
  min-height: 250px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.book-cover {
  display: grid;
  min-height: 110px;
  place-items: center;
  border-radius: 8px;
  background: #e8f0f2;
  color: var(--primary);
  font-size: 42px;
  font-weight: 800;
}

.book-card-body {
  display: grid;
  gap: 7px;
}

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

.reader-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

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

.reading-text {
  display: grid;
  gap: 16px;
  padding: 18px;
  font-size: 16px;
  line-height: 1.9;
}

.reader-tags {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.task-list {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.task-list article {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.task-list article span {
  color: #3b4850;
  line-height: 1.55;
}

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

.ability-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.ability-panel.is-empty {
  background: #f8faf9;
}

.ability-button {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: var(--soft);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
}

.ability-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.ability-button span {
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.ability-button:disabled span {
  background: #c8d1d0;
}

.ability-task-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.ability-panel.is-collapsed .ability-task-list {
  display: none;
}

.ability-task-list article {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: start;
  padding: 8px;
  border-radius: 6px;
  background: #fff;
}

.ability-task-card {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 6px 8px;
  align-items: start;
  width: 100%;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.ability-task-card:hover,
.ability-task-card.active {
  border-color: #14b8a6;
  background: #f0fdfa;
}

.ability-task-card strong {
  grid-row: span 2;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.ability-task-card span {
  color: var(--text);
  line-height: 1.45;
}

.ability-task-card small {
  color: var(--muted);
  line-height: 1.45;
}

.ability-more {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  padding: 4px 2px;
}

.ability-task-list article strong {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.reading-highlight {
  border-radius: 4px;
  background: #fef08a;
  padding: 0 2px;
}

.practice-panel {
  display: grid;
  gap: 10px;
  margin-top: 2px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

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

.practice-header strong {
  color: #0d9488;
}

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

.practice-question {
  color: var(--text);
  font-weight: 700;
  line-height: 1.55;
}

.practice-evidence {
  border-left: 3px solid #14b8a6;
  padding: 8px 10px;
  background: #f8faf9;
  color: #3b4850;
  line-height: 1.55;
}

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

.practice-feedback {
  white-space: normal;
  color: #1f2933;
  line-height: 1.65;
}

.diagnosis-content {
  padding: 4px 14px 14px;
}

.empty-state.small {
  padding: 16px;
}

.muted {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.dialogue-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
}

.dialogue-source {
  display: grid;
  gap: 8px;
}

.dialogue-source-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  color: var(--muted);
  font-size: 13px;
}

.dialogue-source-header span {
  font-weight: 700;
}

.dialogue-source-header small {
  overflow: hidden;
  max-width: 170px;
  color: #7a8a92;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialogue-source-text {
  max-height: 220px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fbfcfc;
  color: var(--text);
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
}

textarea {
  width: 100%;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  line-height: 1.5;
}

.dialogue-panel {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  min-height: 620px;
}

.message-list {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding: 16px;
  background: #fbfcfc;
}

.message {
  display: grid;
  gap: 6px;
  max-width: 78%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.message.user {
  justify-self: end;
  background: #e8f0f2;
}

.message.assistant {
  justify-self: start;
}

.message.error {
  justify-self: start;
  border-color: #e2b0b0;
  background: #fff3f3;
}

.message-role {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.message-text {
  white-space: pre-wrap;
  line-height: 1.65;
}

.message-text p,
.practice-feedback p {
  margin: 0 0 8px;
}

.message-text p:last-child,
.practice-feedback p:last-child {
  margin-bottom: 0;
}

.message-text ul,
.message-text ol,
.practice-feedback ul,
.practice-feedback ol {
  display: grid;
  gap: 5px;
  margin: 6px 0 8px;
  padding-left: 18px;
}

.message-text li,
.practice-feedback li {
  line-height: 1.6;
}

.message-text h3,
.message-text h4,
.message-text h5,
.practice-feedback h3,
.practice-feedback h4,
.practice-feedback h5 {
  margin: 8px 0 6px;
  font-size: 14px;
  line-height: 1.45;
}

.message-text code,
.practice-feedback code {
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(9, 9, 11, 0.08);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 0.92em;
}

.dialogue-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: none;
  max-width: min(420px, calc(100vw - 48px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #17262d;
  color: #ffffff;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.toast.show {
  display: block;
}

.student-body {
  background: #edf3f0;
}

.student-shell {
  min-height: 100vh;
  padding: 22px;
}

.student-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  max-width: 1240px;
  margin: 0 auto 18px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.student-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.student-workspace {
  display: grid;
  gap: 18px;
  max-width: 1240px;
  margin: 0 auto;
}

.student-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.student-hero p {
  margin-top: 7px;
  color: var(--muted);
}

.student-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.student-tab {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-weight: 800;
}

.student-tab.active,
.student-tab:hover {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.student-view {
  display: none;
}

.student-view.active {
  display: block;
}

@media (max-width: 980px) {
  .ability-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    gap: 14px;
    padding: 18px;
  }

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

  .nav-item {
    min-height: 38px;
    text-align: center;
  }

  .sidebar-footer {
    margin-top: 0;
  }

  .split-layout,
  .form-grid,
  .dialogue-layout,
  .reader-layout,
  .metric-grid,
  .profile-grid,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .message {
    max-width: 100%;
  }

  .dialogue-form {
    grid-template-columns: 1fr;
  }

  .topbar,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .main {
    padding: 22px;
  }

  .student-shell {
    padding: 16px;
  }

  .student-header,
  .student-hero,
  .student-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

/* Student bookshelf, assignments and book detail. */
.student-today-panel {
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid #bae6fd;
  border-radius: 18px;
  background: linear-gradient(135deg, #f0f9ff 0%, #f0fdfa 100%);
}

.student-section-heading,
.student-book-detail-header {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
}

.student-section-heading h2,
.student-book-detail-header h2 {
  margin: 3px 0 0;
}

.student-section-heading > span {
  color: #0f766e;
  font-size: 13px;
  font-weight: 800;
}

.student-section-eyebrow {
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

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

.student-today-task,
.student-today-empty {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 15px 16px;
  border: 1px solid rgba(14, 116, 144, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
}

.student-today-empty {
  grid-column: 1 / -1;
}

.student-today-task > div,
.student-today-empty > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.student-today-task span,
.student-today-task small,
.student-today-empty span {
  color: var(--muted);
  font-size: 12px;
}

.student-today-task strong,
.student-today-empty strong {
  overflow: hidden;
  color: #164e63;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-today-task.is-today {
  border-color: #fbbf24;
}

.student-today-task.is-overdue {
  border-color: #fca5a5;
  background: #fff7f7;
}

.student-today-task.is-technical-error {
  border-color: #fdba74;
  background: #fff7ed;
}

.student-today-task.is-submitted {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.student-today-task.is-evaluated,
.student-today-task.is-exempt {
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.student-task-status {
  display: inline-flex;
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569 !important;
  font-weight: 800;
}

.bookshelf-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 20px;
  padding: 14px;
  border-radius: 14px;
  background: #f8fafc;
}

.bookshelf-filters label {
  display: grid;
  gap: 6px;
}

.bookshelf-filters label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bookshelf-filters select {
  min-width: 0;
  min-height: 42px;
}

.student-book-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.student-book-detail {
  scroll-margin-top: 100px;
}

.student-book-detail-header p {
  max-width: 820px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.student-book-detail-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0 12px;
}

.student-book-detail-metrics > div {
  display: grid;
  gap: 6px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafafa;
}

.student-book-detail-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.student-book-detail-metrics strong {
  font-size: 16px;
}

.student-book-detail-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.student-book-detail-tags span,
.reader-guide-tags span {
  padding: 5px 9px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 12px;
  font-weight: 700;
}

.student-chapter-directory {
  max-height: 500px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
}

.student-chapter-directory section + section {
  border-top: 1px solid var(--border);
}

.student-chapter-directory h3 {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  margin: 0;
  padding: 12px 16px;
  background: #f8fafc;
  font-size: 15px;
}

.student-chapter-directory h3 small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.student-chapter-directory section > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.student-chapter-directory button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid #f1f5f9;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.student-chapter-directory button:hover {
  background: #f0fdfa;
}

.student-chapter-directory button > span,
.student-chapter-directory button > small {
  color: var(--muted);
  font-size: 11px;
}

.student-book-detail-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

/* Visual alignment with the original demo HTML pages. */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-soft: #fafafa;
  --border: rgba(24, 24, 27, 0.08);
  --text: #09090b;
  --muted: #71717a;
  --primary: #14b8a6;
  --primary-dark: #0d9488;
  --accent: #0f766e;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow: 0 20px 40px -24px rgba(9, 9, 11, 0.22);
  --soft-shadow: 0 4px 20px -10px rgba(9, 9, 11, 0.08);
}

body {
  background: #fafafa;
  color: #09090b;
  font-family:
    "Inter",
    "Microsoft YaHei",
    "PingFang SC",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

body:not(.student-body) .app-shell {
  display: block;
  min-height: 100vh;
}

body:not(.student-body) .sidebar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  min-height: 66px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  background: rgba(255, 255, 255, 0.86);
  color: #09090b;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: #09090b;
  color: #ffffff;
  box-shadow: 0 10px 24px -14px rgba(9, 9, 11, 0.5);
}

.brand-title {
  color: #09090b;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  color: #71717a;
}

body:not(.student-body) .nav-list {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0;
}

body:not(.student-body) .nav-item {
  width: auto;
  flex: 0 0 auto;
  min-height: 66px;
  padding: 0 11px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #52525b;
  font-size: 14px;
  font-weight: 650;
  text-align: center;
}

body:not(.student-body) .nav-item:hover,
body:not(.student-body) .nav-item.active {
  border-color: #14b8a6;
  background: transparent;
  color: #0d9488;
}

body:not(.student-body) .sidebar-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 0;
}

body:not(.student-body) .sidebar-footer .server-state {
  max-width: 210px;
}

body:not(.student-body) .main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

.topbar,
.student-hero,
.student-header {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: var(--soft-shadow);
}

.topbar {
  padding: 24px;
}

h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.login-form,
.panel,
.metric-card,
.book-card,
.student-tab {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: var(--soft-shadow);
}

.login-form,
.form-panel {
  padding: 22px;
}

.form-panel .panel-header {
  margin: -22px -22px 2px;
}

.panel-header {
  padding: 18px 20px;
  background: #ffffff;
}

input,
select,
textarea {
  min-height: 46px;
  border-color: #e4e4e7;
  border-radius: 16px;
  background: #fafafa;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #18181b;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(9, 9, 11, 0.08);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(35, 95, 115, 0.32);
  outline-offset: 2px;
}

.primary-button,
.secondary-button,
.mini-button {
  border-radius: 14px;
  font-weight: 750;
}

.primary-button {
  background: #09090b;
  color: #ffffff;
  box-shadow: 0 12px 24px -18px rgba(9, 9, 11, 0.7);
}

.primary-button:hover {
  background: #27272a;
}

.secondary-button,
.mini-button {
  background: #ffffff;
  border-color: #e4e4e7;
  color: #27272a;
}

.secondary-button:hover,
.mini-button:hover {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #0d9488;
}

.metric-grid,
.profile-grid {
  gap: 16px;
}

.metric-card {
  min-height: 132px;
}

.metric-card strong {
  font-size: 32px;
  letter-spacing: -0.04em;
}

.split-layout,
.form-grid,
.dialogue-layout,
.reader-layout {
  gap: 20px;
}

.list-card,
.unit-item,
.review-item,
.task-list article {
  border-color: #f1f1f2;
  border-radius: 20px;
  background: #ffffff;
}

.unit-item:hover,
.book-card:hover,
.task-list article:hover {
  transform: translateY(-2px);
  border-color: #ccfbf1;
  box-shadow: 0 20px 40px -24px rgba(20, 184, 166, 0.28);
}

.book-card {
  transition:
    transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.28s ease,
    border-color 0.28s ease;
}

.student-book-card {
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 390px;
  padding: 16px;
}

.book-cover {
  position: relative;
  min-height: 150px;
  overflow: hidden;
  border-radius: 20px;
  background:
    radial-gradient(circle at 15% 10%, rgba(20, 184, 166, 0.18), transparent 34%),
    linear-gradient(135deg, #f0fdfa, #f8fafc);
  color: #134e4a;
}

.student-book-card .book-cover {
  width: min(100%, 188px);
  height: 260px;
  justify-self: center;
  min-height: 0;
}

.book-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-cover span {
  position: relative;
  z-index: 1;
}

.book-cover.has-image span {
  display: none;
}

.book-cover-fallback {
  align-content: center;
  justify-items: center;
  gap: 12px;
  padding: 22px 16px;
  text-align: center;
}

.book-cover-fallback::after {
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(20, 184, 166, 0.2);
  border-radius: 15px;
  content: "";
}

.book-cover-fallback .book-cover-mark {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: #0f766e;
  color: #ffffff;
  font-size: 24px;
  font-weight: 900;
}

.book-cover-fallback strong {
  position: relative;
  z-index: 1;
  color: #134e4a;
  font-family:
    "Noto Serif SC",
    "Songti SC",
    "SimSun",
    serif;
  font-size: 23px;
  font-weight: 800;
  line-height: 1.3;
}

.book-cover-fallback small {
  position: relative;
  z-index: 1;
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
}

.book-card-heading {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.book-card-heading strong {
  color: #18181b;
  font-size: 19px;
  font-weight: 900;
  line-height: 1.3;
}

.book-card-heading span {
  color: #71717a;
  font-size: 13px;
  font-weight: 700;
}

.book-card-description {
  display: -webkit-box;
  min-height: 60px;
  overflow: hidden;
  margin: 0;
  color: #52525b;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.book-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.book-tag {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: #f4f4f5;
  color: #52525b;
  font-size: 12px;
  font-weight: 800;
}

.status {
  min-height: 27px;
  border-radius: 10px;
  background: #f4f4f5;
  color: #52525b;
}

.status.pending_review {
  background: #fffbeb;
  color: #b45309;
}

.status.published {
  background: #f0fdfa;
  color: #0d9488;
}

.status.rejected {
  background: #fef2f2;
  color: #b91c1c;
}

.tag {
  border-radius: 9px;
  background: #f0fdfa;
  color: #0d9488;
  font-weight: 700;
}

.reading-text {
  color: #3f3f46;
  font-family:
    "Noto Serif SC",
    "Songti SC",
    "SimSun",
    serif;
  font-size: 17px;
  line-height: 2.1;
}

.reader-panel {
  min-height: 650px;
}

.message-list {
  background: #ffffff;
}

.message {
  border-radius: 20px;
  box-shadow: 0 8px 24px -20px rgba(9, 9, 11, 0.2);
}

.message.user {
  background: #09090b;
  color: #ffffff;
}

.message.user .message-role {
  color: #d4d4d8;
}

.message.assistant {
  border-color: #ccfbf1;
  background: #f0fdfa;
  color: #134e4a;
}

.dialogue-form {
  background: #ffffff;
}

.toast {
  border-radius: 18px;
  background: rgba(9, 9, 11, 0.92);
  backdrop-filter: blur(10px);
}

.student-shell {
  max-width: 1280px;
  margin: 0 auto;
}

.student-body {
  background: #fafafa;
}

.student-header {
  position: sticky;
  top: 18px;
  z-index: 40;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.student-hero {
  padding: 26px;
}

.student-tabs {
  gap: 12px;
}

.student-tab {
  min-height: 48px;
  box-shadow: none;
}

.student-tab.active,
.student-tab:hover {
  border-color: #09090b;
  background: #09090b;
  color: #ffffff;
}

@media (max-width: 1180px) {
  body:not(.student-body) .sidebar {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px 18px;
  }

  body:not(.student-body) .nav-list {
    order: 3;
  }

  body:not(.student-body) .sidebar-footer {
    flex-wrap: wrap;
  }
}

@media (max-width: 980px) {
  body:not(.student-body) .nav-list {
    grid-template-columns: none;
  }

  body:not(.student-body) .nav-item {
    min-height: 42px;
    padding: 0 10px;
  }

  .topbar {
    padding: 20px;
  }

  h1 {
    font-size: 28px;
  }
}

/* Student immersive reading page. */
.student-body .student-shell {
  width: min(1840px, calc(100vw - 32px));
  max-width: none;
  padding-bottom: 34px;
}

.student-body[data-student-view="reader"] .student-shell {
  width: min(1920px, calc(100vw - 24px));
}

.student-workspace {
  width: 100%;
  max-width: none;
}

.student-workspace[data-active-view="reader"] {
  gap: 12px;
}

.student-workspace[data-active-view="reader"] .student-hero {
  display: none;
}

.student-workspace[data-active-view="reader"] .student-tabs {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: min(760px, 100%);
  margin: 0 auto;
}

.immersive-reader-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 18px;
  align-items: start;
  min-height: calc(100vh - 170px);
}

.immersive-reader-layout.is-exam-expanded {
  grid-template-columns: minmax(0, 2fr) minmax(520px, 3fr);
}

.immersive-reading-pane {
  --reader-sticky-offset: 86px;
  position: relative;
  min-width: 0;
  min-height: calc(100vh - 170px);
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--soft-shadow);
  overflow: hidden;
}

.immersive-reader-bar {
  position: sticky;
  top: 86px;
  z-index: 15;
  display: grid;
  grid-template-columns: minmax(190px, 0.65fr) minmax(210px, 0.8fr) minmax(420px, 1.55fr);
  gap: 16px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.reader-return {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.reader-return > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.reader-return span,
.reader-selectors span,
.reader-progress span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.reader-return strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-progress {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.reader-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.reader-progress-track i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #09090b;
  transition: width 0.22s ease;
}

.reader-selectors {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 10px;
}

.reader-selectors.has-chapters {
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.15fr) minmax(0, 1.3fr);
}

.reader-selectors label {
  display: grid;
  gap: 4px;
}

.reader-selectors label[hidden] {
  display: none;
}

.reader-selectors select {
  min-height: 38px;
  border-radius: 10px;
  font-size: 13px;
}

.reader-document {
  width: 100%;
  min-height: calc(100vh - 245px);
  margin: 0 auto;
  padding: calc(34px + var(--reader-sticky-offset)) clamp(88px, 8vw, 132px) 70px;
}

.reader-document-heading,
.reader-document .reader-tags,
.reader-document .reading-text {
  max-width: 880px;
  margin-right: auto;
  margin-left: auto;
}

.reader-selection-quote-action {
  position: fixed;
  z-index: 80;
  display: flex;
  max-width: min(420px, calc(100vw - 24px));
  align-items: center;
  gap: 10px;
  padding: 8px 9px 8px 12px;
  border: 1px solid #99f6e4;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 16px 38px -16px rgba(15, 118, 110, 0.45);
}

.reader-selection-quote-action span {
  min-width: 0;
  overflow: hidden;
  color: #3f3f46;
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-selection-quote-action button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: #0f766e;
  color: #ffffff;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.student-quote-source-lock {
  margin: -2px 0 2px;
  padding: 9px 11px;
  border: 1px solid #99f6e4;
  border-radius: 10px;
  background: #f0fdfa;
  color: #0f766e;
  font-size: 12px;
  font-weight: 750;
}

.reader-document-heading {
  display: grid;
  gap: 8px;
  justify-items: center;
  margin-bottom: 28px;
  text-align: center;
}

.reader-chapter-title {
  max-width: 100%;
  margin: 0;
  color: #667085;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.55;
}

.reader-document-heading h2 {
  margin: 0;
  font-family:
    "Noto Serif SC",
    "Songti SC",
    "SimSun",
    serif;
  color: #18181b;
  font-size: 31px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0;
}

.reader-document-heading span {
  display: inline-flex;
  min-height: 4px;
  align-items: center;
  padding-top: 8px;
  border-top: 4px solid #14b8a6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.reader-document .reading-text {
  padding: 0;
  color: #3f3f46;
  font-size: 19px;
  font-weight: 400;
  line-height: 2.28;
}

.reader-learning-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 880px;
  margin: -6px auto 26px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
}

.reader-learning-guide.is-open {
  padding: 12px;
  border: 1px solid #ccfbf1;
  background: #f0fdfa;
}

.reader-learning-guide:empty {
  display: none;
}

.reader-guide-launch {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.reader-learning-guide.is-open .reader-guide-launch {
  justify-content: space-between;
}

.reader-guide-launch small {
  color: #64748b;
  font-size: 11px;
}

.reader-guide-launch-button {
  padding: 8px 18px;
  border: 1px solid #5eead4;
  border-radius: 999px;
  background: #ffffff;
  color: #0f766e;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 16px rgba(15, 118, 110, 0.08);
}

.reader-guide-launch-button:hover:not(:disabled) {
  border-color: #14b8a6;
  background: #f0fdfa;
}

.reader-guide-launch-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.reader-guide-item {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
}

.reader-guide-item > span {
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
}

.reader-guide-item p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #334155;
  font-size: 13px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.reader-guide-item small {
  color: #64748b;
  font-size: 10px;
  line-height: 1.4;
}

.reader-guide-save {
  justify-self: start;
  padding: 4px 8px;
  border: 1px solid #99f6e4;
  border-radius: 999px;
  background: #ffffff;
  color: #0f766e;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.reader-guide-save:hover {
  background: #ccfbf1;
}

.reader-guide-tags {
  display: flex;
  grid-column: 1 / -1;
  gap: 6px;
  flex-wrap: wrap;
}

.diagnosis-advice-basis {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

/* Student quote library, reflection and four-stage/twelve-ladder profile. */
.student-learning-workbench {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.panel-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.student-library-form {
  display: grid;
  gap: 13px;
  padding: 18px;
}

.student-library-form label {
  display: grid;
  gap: 6px;
}

.student-library-form label > span {
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.student-library-form textarea {
  resize: vertical;
}

.student-quote-tag-picker {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid #dbe7e3;
  border-radius: 12px;
  background: #fbfefd;
}

.student-quote-tag-picker legend {
  padding: 0 5px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.student-quote-tag-picker legend small {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 500;
}

.student-system-tag-options,
.student-selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.student-tag-choice,
.student-selected-tags button,
.student-library-tags button {
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid #d7e6e1;
  border-radius: 999px;
  background: #ffffff;
  color: #35635a;
  font-size: 12px;
  cursor: pointer;
}

.student-tag-choice:hover,
.student-tag-choice.selected,
.student-selected-tags button:hover,
.student-library-tags button:hover {
  border-color: #70b7a6;
  background: #e9f8f3;
  color: #176b59;
}

.student-tag-choice.selected {
  box-shadow: inset 0 0 0 1px #70b7a6;
  font-weight: 800;
}

.student-tag-more {
  justify-self: start;
  padding: 0;
  border: 0;
  background: transparent;
  color: #237a68;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.student-custom-tag-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.student-custom-tag-row button,
.student-filter-reset {
  padding: 7px 12px;
  border: 1px solid #cfe2dc;
  border-radius: 9px;
  background: #f0f9f6;
  color: #176b59;
  font-weight: 700;
  cursor: pointer;
}

.student-selected-tags {
  min-height: 30px;
  align-items: center;
}

.student-selected-tags > span {
  color: var(--muted);
  font-size: 12px;
}

.student-material-source {
  position: relative;
  display: grid;
  gap: 7px;
  padding: 12px 40px 12px 13px;
  border: 1px solid #a7d9cb;
  border-radius: 12px;
  background: #effbf7;
}

.student-material-source > div {
  display: flex;
  gap: 8px;
  align-items: center;
  color: #176b59;
  font-size: 12px;
}

.student-material-source p {
  margin: 0;
  color: #334155;
  font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
  font-size: 13px;
  line-height: 1.7;
}

.student-material-source button {
  position: absolute;
  top: 9px;
  right: 10px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 11px;
  cursor: pointer;
}

.student-material-target-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 11px 12px 12px;
  border: 1px solid #dbe7e3;
  border-radius: 12px;
}

.student-material-target-mode legend {
  padding: 0 5px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.student-material-target-mode label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 31px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  cursor: pointer;
}

.student-material-target-mode label:has(input:checked) {
  background: #dff5ed;
  color: #176b59;
  font-weight: 800;
}

.student-material-target-mode input {
  width: auto;
  min-height: 0;
  margin: 0;
}

.student-portfolio-filters {
  display: grid;
  grid-template-columns: auto minmax(130px, 0.8fr) minmax(130px, 0.8fr) minmax(180px, 1.3fr) auto;
  gap: 10px;
  align-items: end;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #fbfefd;
}

.student-portfolio-filters label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.student-portfolio-filters label > span {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.student-portfolio-kind {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: #edf5f2;
}

.student-portfolio-kind button {
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-weight: 700;
  cursor: pointer;
}

.student-portfolio-kind button.active {
  background: #ffffff;
  color: #176b59;
  box-shadow: 0 1px 4px rgba(30, 64, 55, 0.12);
}

.student-library-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  padding: 16px;
}

.student-library-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
}

.student-library-card-heading {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.student-library-card-heading > span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 11px;
  font-weight: 800;
}

.student-library-card-heading small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-library-card h3,
.student-library-card p {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.7;
}

.student-library-card h3 {
  font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
  font-size: 16px;
}

.student-library-card p {
  color: #475569;
  font-size: 13px;
  white-space: pre-wrap;
}

.student-library-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.student-library-tags span {
  padding: 3px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 10px;
}

.student-library-tags button {
  min-height: 25px;
  padding: 3px 7px;
  border-color: transparent;
  background: #f1f5f9;
  color: #475569;
}

.student-library-tags .student-library-tag-more {
  border-style: dashed;
  border-color: #cbd5e1;
  background: transparent;
}

.student-material-route {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
}

.student-material-route strong {
  color: #0f9b7a;
}

.student-material-source-quote {
  margin: 0;
  padding: 9px 11px;
  border-left: 3px solid #7cc8b7;
  background: #f3faf8;
  color: #475569;
  font-family: "Noto Serif SC", "Songti SC", SimSun, serif;
  font-size: 12px;
  line-height: 1.7;
}

.student-form-actions,
.student-library-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.student-form-actions .primary-button {
  flex: 1;
}

.student-edit-link {
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: #176b59;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.student-delete-link {
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: #b91c1c;
  font-size: 11px;
  cursor: pointer;
}

.student-reflection-points {
  display: grid;
  gap: 5px;
  color: #475569;
  font-size: 12px;
}

.student-reflection-points ul {
  margin: 0;
  padding-left: 20px;
}

.student-growth-profile {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.student-growth-hero {
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  padding: 26px;
  border-radius: 18px;
  background: linear-gradient(135deg, #0f172a 0%, #134e4a 100%);
  color: #ffffff;
}

.student-growth-hero span,
.student-growth-hero p {
  color: #ccfbf1;
}

.student-growth-hero h2 {
  margin: 5px 0 7px;
  color: #ffffff;
  font-size: 30px;
}

.student-growth-hero p {
  margin: 0;
}

.student-growth-word-ring {
  display: grid;
  flex: 0 0 130px;
  width: 130px;
  height: 130px;
  place-content: center;
  border: 8px solid rgba(153, 246, 228, 0.28);
  border-radius: 999px;
  text-align: center;
}

.student-growth-word-ring strong {
  font-size: 22px;
}

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

.student-growth-metrics > div {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
}

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

.student-growth-metrics strong {
  font-size: 20px;
}

.student-growth-gap {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.3fr);
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid #fde68a;
  border-radius: 14px;
  background: #fffbeb;
}

.student-growth-gap h3,
.student-growth-gap p {
  margin: 4px 0;
}

.student-growth-gap p {
  color: #78716c;
  font-size: 13px;
}

.student-growth-task-gaps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.student-growth-task-gaps > span {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  font-size: 12px;
}

.student-growth-task-gaps strong {
  font-size: 17px;
}

.student-growth-task-gaps small {
  color: var(--muted);
}

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

.student-growth-columns > section {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
}

.student-growth-columns h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.student-growth-columns ol {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 20px;
  color: #475569;
  font-size: 13px;
  line-height: 1.55;
}

.student-effort-list,
.student-ability-trends {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.student-effort-list li,
.student-ability-trends > div {
  display: grid;
  gap: 3px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.student-effort-list span,
.student-ability-trends span {
  font-size: 12px;
  font-weight: 700;
}

.student-effort-list small,
.student-ability-trends small {
  color: var(--muted);
  font-size: 10px;
}

.student-ability-trends > div {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline;
}

.student-ability-trends .is-improving {
  color: #047857;
}

.student-ability-trends .is-declining {
  color: #b91c1c;
}

.student-growth-method {
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  color: #475569;
  font-size: 12px;
  line-height: 1.6;
}

.student-growth-method summary {
  color: #0f172a;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 1100px) {
  .bookshelf-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .student-book-detail-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .student-growth-columns {
    grid-template-columns: 1fr 1fr;
  }

  .student-portfolio-filters {
    grid-template-columns: auto repeat(2, minmax(130px, 1fr));
  }

  .student-portfolio-search {
    grid-column: 1 / span 2;
  }
}

@media (max-width: 760px) {
  .student-today-list,
  .reader-learning-guide,
  .student-chapter-directory section > div,
  .student-learning-workbench,
  .student-library-list,
  .student-growth-columns,
  .student-growth-gap {
    grid-template-columns: 1fr;
  }

  .bookshelf-filters,
  .student-book-detail-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reader-guide-tags {
    grid-column: 1;
  }

  .reader-guide-launch,
  .reader-learning-guide.is-open .reader-guide-launch {
    align-items: stretch;
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }

  .student-today-task,
  .student-today-empty,
  .student-section-heading,
  .student-book-detail-header,
  .student-growth-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .student-growth-metrics,
  .student-growth-task-gaps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .student-portfolio-filters {
    grid-template-columns: 1fr;
  }

  .student-portfolio-search {
    grid-column: 1;
  }

  .student-portfolio-kind {
    justify-self: start;
  }

  .student-quote-tag-picker legend small {
    display: block;
    margin: 3px 0 0;
  }
}

.reader-document .reader-tags {
  justify-content: center;
  margin-bottom: 24px;
  padding: 0 0 18px;
}

.reader-document .reading-text p {
  margin: 0;
  text-align: justify;
}

.reader-page-button {
  position: absolute;
  top: clamp(230px, 48vh, 520px);
  z-index: 12;
  display: inline-flex;
  gap: 0;
  align-items: center;
  justify-content: center;
  width: 52px;
  min-width: 52px;
  min-height: 52px;
  padding: 0;
  border: 1px solid #e4e4e7;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #18181b;
  box-shadow: 0 16px 34px -24px rgba(9, 9, 11, 0.45);
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.reader-page-button span {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #09090b;
  color: #ffffff;
  font-size: 18px;
  line-height: 1;
}

.reader-page-button strong {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.reader-page-button:hover {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #0d9488;
}

.reader-page-button:disabled {
  opacity: 0.36;
  cursor: not-allowed;
}

.reader-page-button:disabled:hover {
  border-color: #e4e4e7;
  background: rgba(255, 255, 255, 0.92);
  color: #18181b;
}

.reader-page-button-left {
  left: 18px;
}

.reader-page-button-right {
  right: 18px;
}

.reader-ai-dock {
  position: sticky;
  top: 86px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 12px;
  min-width: 0;
  height: calc(100vh - 190px);
  min-height: 520px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--soft-shadow);
  overflow: hidden;
}

.reader-exam-layout-toolbar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reader-exam-layout-toolbar span {
  color: #52525b;
  font-size: 11px;
  font-weight: 850;
}

.reader-exam-layout-toolbar button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}

.reader-exam-layout-toolbar button:hover {
  border-color: #60a5fa;
  background: #dbeafe;
}

.reader-ai-dock.is-exam-expanded .reader-ai-tabs,
.reader-ai-dock.is-exam-locked .reader-ai-tabs {
  max-height: none;
}

.reader-ai-tabs {
  display: grid;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  max-height: clamp(160px, 30vh, 280px);
  overflow: auto;
  padding-right: 8px;
  scrollbar-gutter: stable;
}

.reader-ai-tabs.is-collapsed {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.task-panel-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  background: #ffffff;
}

.task-panel-summary {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.task-panel-summary strong,
.task-panel-summary span,
.task-panel-summary small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-panel-summary strong {
  color: #0d9488;
  font-size: 13px;
  font-weight: 900;
}

.task-panel-summary span {
  color: #27272a;
  font-size: 12px;
  font-weight: 800;
}

.task-panel-summary small {
  color: #71717a;
  font-size: 11px;
  font-weight: 700;
}

.task-panel-toggle {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #d4d4d8;
  border-radius: 999px;
  background: #ffffff;
  color: #18181b;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.task-panel-clear {
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid #e4e4e7;
  border-radius: 999px;
  background: #fafafa;
  color: #52525b;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.task-panel-toggle:hover,
.task-panel-clear:hover {
  border-color: #14b8a6;
  color: #0d9488;
}

.reader-ai-tabs.is-collapsed .ability-tab-strip,
.reader-ai-tabs.is-collapsed .ability-card-list,
.reader-ai-tabs.is-collapsed .interaction-mode-panel,
.reader-ai-tabs.is-collapsed .exam-panel-body {
  display: none;
}

.exam-panel-control {
  grid-template-columns: minmax(0, 1fr) auto;
  border-color: #dbeafe;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 72%);
}

.exam-panel-summary strong {
  color: #1d4ed8;
}

.exam-summary-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.exam-summary-status {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 5px 7px;
  border-radius: 8px;
  background: #f4f4f5;
  color: #71717a;
  font-size: 10px;
  font-weight: 800;
}

.exam-summary-status b {
  overflow: hidden;
  color: #3f3f46;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exam-summary-status.is-progress {
  background: #fff7ed;
  color: #c2410c;
}

.exam-summary-status.is-completed {
  background: #ecfdf5;
  color: #047857;
}

.exam-panel-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.exam-panel-note {
  margin: 0;
  color: #71717a;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}

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

.exam-behavior-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  min-height: 86px;
  padding: 9px;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  background: #ffffff;
  color: #27272a;
  text-align: left;
  cursor: pointer;
}

.exam-behavior-card:hover,
.exam-behavior-card.active {
  border-color: #60a5fa;
  background: #eff6ff;
  box-shadow: 0 8px 22px -18px rgba(37, 99, 235, 0.9);
}

.exam-behavior-card.is-progress {
  border-color: #fed7aa;
}

.exam-behavior-card.is-completed {
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.exam-behavior-card:disabled,
.exam-behavior-card.is-unavailable {
  opacity: 0.58;
  cursor: not-allowed;
}

.exam-behavior-title {
  display: grid;
  gap: 2px;
}

.exam-behavior-title strong {
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}

.exam-behavior-title em {
  color: #71717a;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.exam-behavior-card small {
  display: -webkit-box;
  overflow: hidden;
  color: #71717a;
  font-size: 10px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.exam-stars {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  color: #d4d4d8;
}

.exam-stars i {
  font-size: 20px;
  font-style: normal;
  line-height: 1;
}

.exam-stars i.filled {
  color: #f59e0b;
}

.exam-stars b {
  margin-left: 6px;
  color: #92400e;
  font-size: 13px;
}

.exam-stars.compact i {
  font-size: 11px;
}

.exam-choice-hint,
.exam-service-state {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border: 1px dashed #d4d4d8;
  border-radius: 12px;
  background: #fafafa;
  color: #71717a;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.exam-service-state.error {
  flex-wrap: wrap;
  border-color: #fecaca;
  background: #fff7f7;
  color: #991b1b;
}

.exam-service-state.error span {
  flex-basis: 100%;
}

.exam-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid #bfdbfe;
  border-top-color: #2563eb;
  border-radius: 999px;
  animation: exam-spin 0.8s linear infinite;
}

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

.exam-challenge-card,
.exam-question,
.exam-answer-form,
.exam-result-card {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 11px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #f8fbff;
}

.exam-challenge-card > div {
  display: grid;
  gap: 4px;
}

.exam-challenge-card strong,
.exam-question > span,
.exam-result-card > span {
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
}

.exam-challenge-card span,
.exam-question small,
.exam-submit-note {
  color: #71717a;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}

.exam-challenge-card.error {
  border-color: #fecaca;
  background: #fff7f7;
}

.exam-challenge-card.error strong,
.exam-inline-error {
  color: #b91c1c;
}

.exam-question strong {
  color: #18181b;
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.exam-answer-requirement {
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  border-left: 3px solid #60a5fa;
  border-radius: 7px;
  background: #eff6ff;
}

.exam-answer-requirement b {
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 900;
}

.exam-answer-requirement small {
  color: #3f3f46;
  overflow-wrap: anywhere;
}

.exam-answer-form {
  border-color: #e4e4e7;
  background: #ffffff;
}

.exam-answer-form label {
  display: grid;
  gap: 5px;
}

.exam-answer-form label > span {
  color: #3f3f46;
  font-size: 11px;
  font-weight: 850;
}

.exam-answer-form textarea {
  width: 100%;
  min-height: 68px;
  resize: vertical;
  padding: 9px 10px;
  border: 1px solid #d4d4d8;
  border-radius: 10px;
  background: #ffffff;
  color: #18181b;
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
}

.exam-answer-form textarea:focus {
  outline: 2px solid #bfdbfe;
  border-color: #3b82f6;
}

.exam-answer-form textarea[readonly] {
  background: #f4f4f5;
  color: #52525b;
}

.exam-submit-button {
  width: 100%;
}

.exam-inline-error {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.45;
}

.exam-result-card {
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.exam-result-card > span {
  color: #047857;
}

.exam-result-card p {
  margin: 0;
  color: #14532d;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.55;
}

.exam-result-feedback {
  display: grid;
  gap: 5px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.exam-result-feedback strong {
  color: #047857;
  font-size: 11px;
  font-weight: 900;
}

.exam-score-total {
  color: #14532d;
  font-size: 13px;
  font-weight: 900;
}

.exam-dimension-wrap,
.exam-feedback-details {
  display: grid;
  gap: 7px;
  padding: 9px 10px;
  border: 1px solid rgba(5, 150, 105, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
}

.exam-dimension-wrap > strong {
  color: #047857;
  font-size: 11px;
  font-weight: 900;
}

.exam-dimension-list {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.exam-dimension-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #d1fae5;
  border-radius: 8px;
  background: #f7fefb;
}

.exam-dimension-card > div {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.exam-dimension-card strong {
  color: #14532d;
  font-size: 11px;
  font-weight: 900;
}

.exam-dimension-card span {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: #d1fae5;
  color: #047857;
  font-size: 11px;
  font-weight: 900;
}

.exam-dimension-card p {
  overflow-wrap: anywhere;
}

.exam-feedback-section {
  display: grid;
  gap: 4px;
  padding: 7px 8px;
  border-radius: 8px;
  background: #f0fdf4;
  white-space: pre-wrap;
}

.exam-feedback-section > strong {
  color: #047857;
  font-size: 11px;
  font-weight: 900;
}

.exam-feedback-section p {
  overflow-wrap: anywhere;
}

.exam-feedback-details p {
  color: #14532d;
  font-weight: 650;
}

.exam-result-card small {
  color: #047857;
  font-size: 11px;
  font-weight: 800;
}

.reader-free-chat-heading {
  padding: 2px 2px 8px;
  border-bottom: 1px solid #e4e4e7;
}

.reader-free-chat-heading > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.reader-free-chat-heading strong {
  color: #0f766e;
  font-size: 12px;
  font-weight: 900;
}

.reader-free-chat-heading span {
  color: #71717a;
  font-size: 10px;
  font-weight: 700;
}

.reader-free-chat-heading.is-exam-locked {
  border-color: rgba(180, 83, 9, 0.28);
  background: #fff8eb;
}

.reader-free-chat-heading.is-exam-locked strong,
.reader-free-chat-heading.is-exam-locked span {
  color: #9a4b08;
}

.reader-ai-dock.is-exam-locked .reader-ai-form {
  background: #fffaf2;
}

.reader-ai-dock.is-exam-locked {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.reader-ai-dock.is-exam-locked .reader-free-chat-heading,
.reader-ai-dock.is-exam-locked .reader-ai-form {
  display: none;
}

.reader-ai-dock.is-exam-locked .message-list {
  min-height: 0;
  overflow: visible;
  padding: 0;
  background: transparent;
  scrollbar-gutter: auto;
}

.reader-ai-dock.is-exam-locked .reader-ai-input-row textarea,
.reader-ai-dock.is-exam-locked .reader-ai-input-row button {
  cursor: not-allowed;
}

.exam-ai-lock-notice {
  display: grid;
  gap: 6px;
  color: #9a4b08;
  background: #fff8eb;
  border: 1px solid rgba(180, 83, 9, 0.2);
}

.exam-ai-lock-notice strong {
  color: #7c3a06;
}

.reader-ai-dock.is-exam-locked .exam-ai-lock-notice {
  gap: 2px;
  min-height: 0;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.45;
}

.reader-ai-dock .ability-tab-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
  background: #f4f4f5;
}

.reader-ai-dock .ability-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #71717a;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.reader-ai-dock .ability-button.active {
  background: #ffffff;
  color: #09090b;
  box-shadow: 0 8px 20px -16px rgba(9, 9, 11, 0.45);
}

.reader-ai-dock .ability-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.reader-ai-dock .ability-button span {
  min-width: 21px;
  height: 21px;
  border-radius: 999px;
  background: #e4e4e7;
  color: #52525b;
  font-size: 11px;
}

.reader-ai-dock .ability-button.active span {
  background: #09090b;
  color: #ffffff;
}

.ability-card-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.reader-ai-dock .ability-task-card {
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 6px 9px;
  min-width: 0;
  padding: 10px;
  border-color: #f1f1f2;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: none;
  overflow: hidden;
  cursor: default;
}

.reader-ai-dock .ability-task-card:hover,
.reader-ai-dock .ability-task-card.active {
  border-color: #99f6e4;
  background: #f6fffc;
}

.reader-ai-dock .ability-task-card strong {
  grid-row: auto;
  width: 24px;
  height: 24px;
  background: #f4f4f5;
  color: #52525b;
}

.reader-ai-dock .ability-task-card span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.prompt-actions {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 4px;
}

.prompt-action {
  min-width: 0;
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid #e4e4e7;
  border-radius: 10px;
  background: #ffffff;
  color: #3f3f46;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.prompt-action.primary {
  border-color: #b7e4d8;
  background: #f2fbf8;
  color: #115e59;
}

.prompt-action.subtle {
  color: #71717a;
}

.prompt-action:hover {
  border-color: #14b8a6;
  background: #f0fdfa;
  color: #0d9488;
}

.prompt-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.reader-ai-dock .ability-task-card small {
  display: -webkit-box;
  overflow: hidden;
  color: #71717a;
  font-size: 12px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.reader-ai-dock .ability-more {
  padding: 0 4px;
  color: #71717a;
}

.interaction-mode-panel {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  background: #fafafa;
}

.interaction-mode-panel.muted-panel {
  color: #71717a;
  font-size: 12px;
  line-height: 1.55;
}

.interaction-current-task {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.interaction-current-task strong {
  color: #0d9488;
  font-size: 12px;
}

.interaction-current-task span {
  display: -webkit-box;
  overflow: hidden;
  color: #27272a;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.interaction-mode-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.interaction-mode-buttons.single {
  grid-template-columns: 1fr;
  margin-top: 8px;
}

.mode-button {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 50px;
  padding: 8px 10px;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  background: #ffffff;
  color: #18181b;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.mode-button span {
  color: #71717a;
  font-size: 11px;
  font-weight: 700;
}

.mode-button:hover,
.mode-button.active {
  border-color: #14b8a6;
  background: #f0fdfa;
  color: #0d9488;
}

.diagnostic-result-inline {
  padding: 8px 10px;
  border-radius: 10px;
  background: #ecfeff;
  color: #155e75;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.reader-ai-dock .practice-panel {
  margin: 0;
  padding: 12px;
  border-color: #ccfbf1;
  border-radius: 12px;
  background: #f8fffd;
}

.reader-ai-dock .practice-panel.empty-state {
  border-color: #f1f1f2;
  background: #fafafa;
}

.reader-ai-dock .practice-evidence {
  max-height: 110px;
  overflow: auto;
  border-left-color: #14b8a6;
  border-radius: 0 8px 8px 0;
  font-size: 12px;
}

.reader-ai-dock .practice-question {
  font-size: 13px;
}

.reader-ai-dock .message-list {
  align-content: start;
  grid-auto-rows: max-content;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior: contain;
  padding: 8px 10px 18px 0;
  background: #ffffff;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.reader-ai-dock .message-list::-webkit-scrollbar,
.reader-ai-tabs::-webkit-scrollbar {
  width: 10px;
}

.reader-ai-dock .message-list::-webkit-scrollbar-track,
.reader-ai-tabs::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #f4f4f5;
}

.reader-ai-dock .message-list::-webkit-scrollbar-thumb,
.reader-ai-tabs::-webkit-scrollbar-thumb {
  border: 2px solid #f4f4f5;
  border-radius: 999px;
  background: #a1a1aa;
}

.reader-ai-dock .message {
  min-width: 0;
  max-width: 92%;
  overflow: visible;
  border-radius: 14px;
  box-shadow: none;
}

.reader-ai-dock .message-text {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.reader-ai-dock .message .tag-list {
  min-width: 0;
  overflow: hidden;
}

.reader-ai-dock .message .tag {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.reader-ai-dock .message.user {
  border-color: #09090b;
  background: #09090b;
  color: #ffffff;
}

.reader-ai-dock .message.assistant {
  border-color: #ccfbf1;
  background: #f0fdfa;
  color: #134e4a;
}

.reader-ai-dock .message.notice {
  max-width: 100%;
  border-color: #e4e4e7;
  background: #fafafa;
  color: #3f3f46;
}

.reader-ai-dock .message.streaming .message-text::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 4px;
  border-radius: 999px;
  background: currentColor;
  vertical-align: middle;
  opacity: 0.45;
}

.reader-ai-dock .message.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.dialogue-empty {
  align-self: center;
  justify-self: stretch;
  padding: 18px 14px;
  border: 1px dashed #d4d4d8;
  border-radius: 14px;
  background: #fafafa;
  color: #71717a;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.reader-ai-form {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  min-width: 0;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid #f1f1f2;
  background: #ffffff;
  overflow: hidden;
}

.reader-ai-form textarea {
  min-height: 38px;
  border-radius: 12px;
  font-size: 13px;
}

.reader-context-hint {
  display: flex;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 32px;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  padding: 7px 10px;
  border: 1px solid #e4e4e7;
  border-radius: 999px;
  background: #fafafa;
  color: #52525b;
  font-size: 12px;
  line-height: 1.35;
}

.reader-context-hint strong {
  flex: 0 0 auto;
  color: #0d9488;
  font-size: 12px;
}

.reader-context-hint span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-ai-input-row {
  display: flex;
  width: 100%;
  max-width: 100%;
  gap: 8px;
  align-items: stretch;
  min-width: 0;
  overflow: hidden;
}

.reader-ai-input-row textarea {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  min-height: 46px;
  max-height: 130px;
  resize: vertical;
}

.reader-ai-input-row .primary-button {
  flex: 0 0 68px;
  min-height: 46px;
  width: 68px;
  padding: 0;
}

.reader-ai-input-row .primary-button:disabled {
  opacity: 0.72;
  cursor: wait;
}

.reading-highlight {
  scroll-margin: 160px;
  border-radius: 2px;
  background: rgba(254, 240, 138, 0.42);
  color: inherit;
  box-shadow: inset 0 -0.38em 0 rgba(250, 204, 21, 0.18);
}

/* 管理端：打标前正文校对冻结（独立于数据接入与打标流程） */
.prelabel-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, #f0fdfa 0%, #ffffff 55%, #f8fafc 100%);
  border-color: #99f6e4;
}

.prelabel-intro h2 {
  margin: 4px 0 6px;
  font-size: 26px;
}

.prelabel-intro p {
  margin: 0;
  color: #475569;
  line-height: 1.7;
}

.prelabel-eyebrow {
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.prelabel-boundary {
  display: grid;
  flex: 0 0 min(360px, 38%);
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid #fbbf24;
  border-radius: 14px;
  background: #fffbeb;
  color: #78350f;
}

.prelabel-boundary span {
  font-size: 13px;
  line-height: 1.55;
}

.prelabel-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.prelabel-steps li {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  padding: 10px 8px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.prelabel-steps li::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 50%;
  left: calc(50% + 34px);
  right: calc(-50% + 34px);
  height: 1px;
  background: #cbd5e1;
}

.prelabel-steps li:last-child::after {
  display: none;
}

.prelabel-steps li span {
  position: relative;
  z-index: 1;
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: #ffffff;
}

.prelabel-steps li.is-active {
  color: #0f766e;
}

.prelabel-steps li.is-active span {
  border-color: #0d9488;
  background: #0d9488;
  color: #ffffff;
}

.prelabel-upload-form,
.prelabel-freeze-panel,
.prelabel-certificate,
.prelabel-history-panel {
  margin-bottom: 18px;
}

.prelabel-upload-form .panel-header > div,
.prelabel-freeze-panel .panel-header > div,
.prelabel-certificate .panel-header > div,
.prelabel-history-panel .panel-header > div {
  min-width: 0;
}

.prelabel-history-toolbar,
.prelabel-history-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.prelabel-history-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #cbd5e1;
  border-left: 4px solid #0d9488;
  border-radius: 12px;
  background: #ffffff;
}

.prelabel-history-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.prelabel-history-heading > div {
  display: grid;
  gap: 3px;
}

.prelabel-history-heading strong {
  color: #0f172a;
  font-size: 16px;
}

.prelabel-history-heading > div > span,
.prelabel-history-meta {
  color: #64748b;
  font-size: 12px;
}

.prelabel-history-codes {
  display: grid;
  grid-template-columns: 0.7fr 1.15fr 1.25fr;
  gap: 10px;
}

.prelabel-history-codes > div {
  display: grid;
  min-width: 0;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 9px;
  background: #f0fdfa;
}

.prelabel-history-codes span {
  color: #64748b;
  font-size: 11px;
}

.prelabel-history-codes code {
  overflow-wrap: anywhere;
  color: #065f46;
  font-size: 13px;
  font-weight: 700;
}

.prelabel-history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

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

.prelabel-file-field {
  padding: 14px;
  border: 1px dashed #94a3b8;
  border-radius: 12px;
  background: #f8fafc;
}

.prelabel-file-field input[type="file"] {
  padding: 8px;
  background: #ffffff;
}

.prelabel-file-field small {
  color: #64748b;
  font-size: 12px;
}

.prelabel-form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}

.prelabel-analysis[hidden],
.prelabel-certificate[hidden] {
  display: none;
}

.prelabel-metrics {
  margin-bottom: 18px;
}

.prelabel-review-grid {
  align-items: start;
  margin-bottom: 18px;
}

.prelabel-issue-list,
.prelabel-diff-list,
.prelabel-warning-resolutions {
  display: grid;
  gap: 10px;
}

.prelabel-issue {
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-left-width: 4px;
  border-radius: 10px;
  background: #ffffff;
}

.prelabel-issue.error {
  border-left-color: #dc2626;
  background: #fef2f2;
}

.prelabel-issue.warning {
  border-left-color: #d97706;
  background: #fffbeb;
}

.prelabel-issue.info {
  border-left-color: #0284c7;
  background: #f0f9ff;
}

.prelabel-issue > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prelabel-issue p {
  margin: 8px 0 4px;
  color: #334155;
  line-height: 1.6;
}

.prelabel-issue small {
  color: #64748b;
}

.prelabel-diff {
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
}

.prelabel-diff-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
}

.prelabel-diff-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.prelabel-diff-columns > div {
  min-width: 0;
  padding: 10px 12px;
}

.prelabel-diff-columns > div + div {
  border-left: 1px solid #e2e8f0;
  background: #f8fafc;
}

.prelabel-diff-columns small {
  color: #64748b;
}

.prelabel-diff-columns p {
  max-height: 8em;
  margin: 6px 0 0;
  overflow: auto;
  color: #334155;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.prelabel-resolution {
  padding: 12px 14px;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  background: #fffbeb;
}

.prelabel-resolution > span {
  color: #78350f;
  font-weight: 700;
  line-height: 1.5;
}

.prelabel-clear-state {
  padding: 12px 14px;
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  background: #ecfdf5;
  color: #047857;
}

.prelabel-confirm-line {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}

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

.prelabel-code-grid > div {
  display: grid;
  min-width: 0;
  gap: 6px;
  padding: 14px;
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  background: #f0fdf4;
}

.prelabel-code-grid span {
  color: #64748b;
  font-size: 12px;
}

.prelabel-code-grid strong,
.prelabel-code-grid code {
  overflow-wrap: anywhere;
  color: #065f46;
  font-size: 15px;
}

.prelabel-verify-ok {
  color: #047857;
  font-weight: 700;
}

.prelabel-verify-bad {
  color: #b91c1c;
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 1280px) {
  .immersive-reading-pane {
    --reader-sticky-offset: 78px;
  }

  .immersive-reader-layout {
    grid-template-columns: minmax(0, 1fr) 380px;
  }

  .reader-page-button {
    min-width: 50px;
    padding: 0 12px;
  }

  .reader-page-button strong {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .immersive-reader-bar {
    grid-template-columns: 1fr;
    top: 78px;
  }

  .reader-ai-dock {
    top: 78px;
    height: calc(100vh - 185px);
  }
}

@media (max-width: 980px) {
  .prelabel-intro {
    align-items: stretch;
    flex-direction: column;
  }

  .prelabel-boundary {
    flex-basis: auto;
  }

  .prelabel-field-grid,
  .prelabel-code-grid,
  .prelabel-history-codes {
    grid-template-columns: 1fr;
  }

  .prelabel-steps {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .prelabel-steps li {
    justify-content: flex-start;
    padding: 4px 8px;
  }

  .prelabel-steps li::after {
    display: none;
  }

  .student-body .student-shell,
  .student-body[data-student-view="reader"] .student-shell {
    width: min(100% - 24px, 760px);
    padding: 12px 0 28px;
  }

  .immersive-reader-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .immersive-reader-layout.is-exam-expanded {
    grid-template-columns: 1fr;
  }

  .immersive-reading-pane {
    min-height: auto;
  }

  .immersive-reader-bar,
  .reader-ai-dock {
    position: static;
  }

  .reader-document {
    width: min(100% - 32px, 720px);
    min-height: auto;
    padding: 28px 0 44px;
  }

  .reader-page-button {
    position: static;
    min-width: 0;
    margin: 0 8px 18px;
  }

  .reader-page-button-left {
    float: left;
  }

  .reader-page-button-right {
    float: right;
  }

  .reader-ai-dock {
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    height: min(760px, calc(100vh - 24px));
    min-height: 560px;
    overflow: hidden;
  }

  .reader-ai-dock.is-exam-locked {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .reader-ai-tabs {
    max-height: clamp(150px, 28vh, 240px);
  }

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

  .runtime-review-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .teacher-filter-row,
  .teacher-admin-row,
  .assignment-form-grid {
    align-items: stretch;
    flex-direction: column;
  }

  .teacher-filter-row label,
  .assignment-form-grid label,
  .inline-form {
    width: 100%;
    flex: 1 1 auto;
  }

  .assignment-requirement-row,
  .assignment-behavior-options {
    grid-template-columns: 1fr;
  }

  .assignment-requirement-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

}

@media (max-width: 640px) {
  .prelabel-diff-columns {
    grid-template-columns: 1fr;
  }

  .prelabel-diff-columns > div + div {
    border-top: 1px solid #e2e8f0;
    border-left: 0;
  }

  .prelabel-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .student-workspace[data-active-view="reader"] .student-tabs {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reader-selectors,
  .reader-selectors.has-chapters,
  .reader-progress {
    grid-template-columns: 1fr;
  }

  .reader-document .reading-text {
    font-size: 16px;
    line-height: 2.1;
  }
}
