:root {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-subtle: #f6f8fb;
  --surface-strong: #111827;
  --line: #d9e1ea;
  --line-strong: #b8c4d1;
  --text: #182230;
  --muted: #66768a;
  --accent: #1f6feb;
  --accent-strong: #1557c0;
  --success: #12905f;
  --danger: #c2362b;
  --warning: #b46b06;
  --shadow: 0 16px 34px rgba(24, 34, 48, 0.08);
  --radius: 8px;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 22px;
  background: #111927;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 0 rgba(17, 25, 39, 0.08);
}

.brand {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

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

.topnav a {
  color: #c9d4e2;
  text-decoration: none;
  padding: 8px 13px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
}

.topnav a.active,
.topnav a:hover {
  color: #fff;
  background: rgba(31, 111, 235, 0.95);
}

.workspace {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
  flex: 1;
}

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

.admin-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.88fr) minmax(480px, 1.12fr);
  gap: 20px;
}

.admin-workbench {
  width: min(1600px, 100%);
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(520px, 1fr) minmax(320px, 390px);
  align-items: stretch;
  gap: 14px;
  padding: 14px;
}

.admin-review-workbench {
  grid-template-columns: minmax(300px, 350px) minmax(640px, 1fr);
}

.collection-workbench {
  width: min(1600px, 100%);
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(480px, 1.2fr) minmax(320px, 0.9fr);
  align-items: start;
  gap: 14px;
  padding: 14px;
}

.control-rail,
.preview-panel,
.admin-list,
.admin-detail,
.collection-column {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.control-rail {
  padding: 18px;
  align-self: start;
  position: sticky;
  top: 80px;
}

.preview-panel,
.admin-list,
.admin-detail,
.collection-column,
.admin-insights > * {
  min-width: 0;
  overflow: hidden;
}

.admin-insights {
  min-width: 0;
  display: block;
  align-self: stretch;
  height: var(--admin-synced-height, auto);
  max-height: var(--admin-synced-height, none);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(24, 34, 48, 0.06);
}

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

.panel-header.compact {
  align-items: center;
}

.admin-workbench .admin-list,
.admin-workbench .admin-detail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(24, 34, 48, 0.06);
}

.admin-workbench .admin-insights > * {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.admin-workbench .admin-insights > *:last-child {
  border-bottom: 0;
}

.queue-panel,
.review-panel {
  align-self: start;
}

.queue-panel,
.review-panel {
  display: flex;
  flex-direction: column;
}

.queue-panel {
  align-self: stretch;
  height: var(--admin-synced-height, auto);
  max-height: var(--admin-synced-height, none);
  overflow: hidden;
}

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

.queue-head {
  display: block;
  padding: 17px 18px 14px;
}

.queue-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.panel-header h1,
.section-head h1,
.panel-header h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.28;
  letter-spacing: 0;
}

.panel-header h2 {
  font-size: 18px;
}

.collection-page-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.collection-page-head h1,
.collection-import h2,
.collection-history h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0;
}

.collection-scope-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 0.86fr);
  gap: 10px;
  width: 100%;
}

.collection-book-filter,
.collection-unit-filter {
  min-width: 172px;
  margin-bottom: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 700;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}

.field label,
.checkbox-field legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
  min-height: 40px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 103, 213, 0.14);
}

.auto-id-field input[readonly] {
  background: #f7f9fc;
  color: var(--muted);
}

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

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

.checkbox-field {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.checkbox-field label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.checkbox-field input {
  width: 16px;
  min-height: 16px;
}

.quality-panel {
  padding: 12px;
  margin: 0 0 16px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.quality-panel .field {
  margin-bottom: 10px;
}

.quality-rules {
  margin-bottom: 0;
}

.quality-options {
  display: grid;
  gap: 4px;
}

.preflight-panel {
  margin: 0 0 16px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.preflight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.preflight-head strong {
  color: var(--text);
  font-size: 14px;
}

.preflight-head span,
.preflight-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.preflight-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.preflight-metrics div {
  min-width: 0;
  padding: 8px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.preflight-metrics span,
.preflight-metrics strong {
  display: block;
  line-height: 1.35;
}

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

.preflight-metrics strong {
  color: var(--text);
  font-size: 18px;
}

.preflight-warning {
  margin: 0 0 10px;
  padding: 8px 10px;
  color: var(--warning);
  background: #fff7ed;
  border: 1px solid #f3d3a1;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.5;
}

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

.coverage-mini-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  color: var(--muted);
  font-size: 12px;
}

.coverage-mini-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coverage-state {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(18, 144, 95, 0.1);
  color: var(--success);
  font-size: 12px;
}

.coverage-state.empty {
  background: rgba(194, 54, 43, 0.09);
  color: var(--danger);
}

.primary-action,
.ghost-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: var(--radius);
  padding: 8px 14px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.primary-action {
  width: 100%;
  color: #fff;
  background: var(--accent);
}

.primary-action:hover {
  background: var(--accent-strong);
}

.ghost-action {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line-strong);
}

.ghost-action:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.ghost-action.success {
  color: var(--success);
  border-color: rgba(22, 121, 79, 0.34);
}

.ghost-action.danger {
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.34);
}

.command-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.paper-actions .ghost-action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.compact-action {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.paper-history-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.paper-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.paper-history-head strong {
  color: var(--text);
  font-size: 14px;
}

.paper-history-list {
  display: grid;
  gap: 8px;
}

.paper-history-row {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  text-align: left;
}

.paper-history-row:hover {
  border-color: var(--accent);
  background: #f5f8ff;
}

.paper-history-row strong,
.paper-history-row span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paper-history-row strong {
  font-size: 13px;
  line-height: 1.35;
}

.paper-history-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

body.printable-paper {
  background: #fff;
}

.status-line {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status-line.error {
  color: var(--danger);
}

.status-line.ok {
  color: var(--success);
}

.status-line.warning {
  color: var(--warning);
}

.paper-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px 0;
}

.meta-chip,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.library-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.library-stage {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

.library-stage strong,
.library-stage span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-stage strong {
  margin-bottom: 3px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}

.library-stage span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.library-stage.active {
  border-color: rgba(31, 111, 235, 0.35);
  background: #f3f7ff;
}

.status-badge.APPROVED {
  color: var(--success);
  background: #eaf7f0;
}

.status-badge.DRAFT,
.status-badge.REVIEWED {
  color: var(--warning);
  background: #fff5db;
}

.status-badge.REVIEWED {
  color: #2454a6;
  background: #edf4ff;
}

.status-badge.OPEN {
  color: #6a4b00;
  background: #fff4c7;
}

.status-badge.BLOCKED {
  color: var(--danger);
  background: #feeceb;
}

.paper-output {
  padding: 18px 20px 24px;
}

.empty-state {
  color: var(--muted);
  min-height: 280px;
  display: grid;
  place-items: center;
}

.question-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

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

.question-index {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.question-main {
  min-width: 0;
}

.question-text {
  margin: 0 0 9px;
  font-size: 16px;
  line-height: 1.7;
}

.question-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.answer-box {
  display: none;
  margin-top: 8px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: #f5f8ff;
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}

.answers-visible .answer-box {
  display: block;
}

.section-head select {
  width: min(240px, 100%);
}

.admin-filters {
  padding: 14px 16px;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.admin-filters select,
.admin-filters input {
  min-width: 0;
}

.admin-filters .field {
  margin-bottom: 0;
}

.search-field input {
  padding-right: 34px;
}

.queue-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bulk-action-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bulk-action-bar .ghost-action {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.bulk-action-bar .ghost-action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.select-all-templates {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.select-all-templates input,
.template-check input {
  width: 16px;
  min-height: 16px;
}

#selectedTemplateCount {
  grid-column: 1 / -1;
}

.template-table {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.template-row {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  border-left: 3px solid transparent;
}

.template-check {
  display: grid;
  place-items: center;
  border-right: 1px solid #eef2f6;
}

.template-row-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 10px 14px 10px 10px;
  text-align: left;
}

.template-row:hover,
.template-row.selected {
  background: #f5f8ff;
}

.template-row.selected {
  border-left-color: var(--accent);
}

.template-row-main strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  line-height: 1.35;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-row-copy {
  min-width: 0;
}

.template-row-copy small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-row-badges {
  display: grid;
  grid-auto-flow: row;
  justify-items: end;
  gap: 5px;
  min-width: 88px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: 112px;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.role-badge.SEED {
  color: #335c98;
  background: #eef5ff;
}

.role-badge.VARIANT {
  color: #7a5200;
  background: #fff4d8;
}

.template-row-main .status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: max-content;
  height: 24px;
  min-height: 24px;
  max-height: 24px;
  align-self: start;
  justify-self: end;
  padding: 3px 8px;
  line-height: 1;
  white-space: nowrap;
  flex: 0 0 auto;
}

#sourceTemplateId:disabled {
  background: #f4f7fb;
  color: var(--muted);
}

.admin-detail {
  align-self: start;
}

.review-toolbar {
  background: #fff;
}

.review-toolbar h2 {
  max-width: 100%;
  font-size: 18px;
  word-break: break-word;
}

.template-context {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.review-feedback-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(240px, 0.9fr);
  gap: 12px;
  padding: 14px 16px 0;
}

.editor-panel {
  min-height: 0;
}

.editor-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.editor-section-head h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.import-panel {
  padding: 16px 20px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.collection-column .import-panel,
.collection-column .import-history,
.collection-column .coverage-panel,
.collection-column .collection-task-panel {
  border-bottom: 0;
}

.collection-import .ai-draft-panel {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.collection-overview .collection-task-panel {
  border-bottom: 1px solid var(--line);
}

.collection-column .import-panel,
.collection-column .import-history,
.collection-column .coverage-panel,
.collection-column .collection-task-panel {
  padding: 16px 18px 18px;
}

.admin-insights .import-panel,
.admin-insights .import-history,
.admin-insights .coverage-panel,
.admin-insights .collection-task-panel {
  padding: 14px 16px 16px;
  border-bottom: 1px solid var(--line);
}

.admin-insights .import-panel,
.admin-insights .coverage-panel {
  background: #fff;
}

.admin-insights .import-history,
.admin-insights .collection-task-panel {
  background: #fbfcfe;
}

.admin-insights > *:last-child {
  border-bottom: 0;
}

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

.import-panel h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0;
}

.import-panel .field {
  margin-bottom: 12px;
}

.file-import-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}

.file-import-row .field {
  margin-bottom: 0;
}

.file-import-row input[type="file"] {
  padding: 7px 10px;
}

.import-result {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.import-summary {
  font-weight: 800;
  color: var(--text);
}

.import-row {
  padding: 9px 10px;
  border-left: 3px solid var(--warning);
  border-radius: var(--radius);
  background: #fff;
}

.import-row.saved {
  border-left-color: var(--success);
}

.import-row.skipped {
  border-left-color: var(--warning);
}

.import-row strong,
.import-row span,
.import-row em {
  display: block;
}

.import-row strong {
  color: var(--text);
}

.import-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.import-row em {
  color: var(--muted);
  font-style: normal;
}

.import-history {
  padding: 16px 20px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.import-history-list {
  display: grid;
  gap: 9px;
}

.history-row {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.history-row-head,
.history-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.history-row-head strong {
  font-size: 14px;
}

.history-row-head span,
.history-meta,
.history-row p,
.history-errors em,
.empty-mini {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.history-meta {
  margin-top: 4px;
}

.history-row p {
  margin: 6px 0 0;
}

.history-errors {
  display: grid;
  gap: 3px;
  margin-top: 6px;
}

.history-errors em {
  font-style: normal;
}

.coverage-panel {
  padding: 16px 20px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.coverage-list {
  display: grid;
  gap: 10px;
  max-height: none;
  overflow: auto;
  padding-right: 2px;
}

.coverage-row {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.coverage-row-head,
.coverage-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.coverage-row-head strong {
  font-size: 14px;
}

.coverage-row-head span {
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}

.coverage-bar {
  height: 7px;
  margin: 8px 0;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-subtle);
}

.coverage-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.coverage-meta,
.coverage-row p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.coverage-row p {
  margin: 6px 0 0;
}

.coverage-more {
  padding: 9px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  line-height: 1.5;
}

.collection-task-panel {
  padding: 16px 20px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.collection-task-list {
  display: grid;
  gap: 9px;
}

.collection-task-row {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.collection-task-head,
.collection-task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.collection-task-head strong {
  min-width: 0;
  font-size: 14px;
}

.collection-task-meta,
.collection-task-row p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.collection-task-row p {
  margin: 6px 0 0;
}

.sample-box {
  min-height: 104px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7faff;
  color: var(--muted);
  line-height: 1.6;
}

.validation-box {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.validation-box.ok {
  color: var(--success);
  border-color: rgba(22, 121, 79, 0.28);
  background: #f2fbf6;
}

.validation-box.error {
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.28);
  background: #fff6f5;
}

.sample-batch-box {
  grid-column: 1 / -1;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.sample-batch-box.ok {
  border-color: rgba(22, 121, 79, 0.26);
  background: #f7fcf9;
}

.sample-batch-box.error {
  border-color: rgba(180, 35, 24, 0.26);
  background: #fff8f7;
}

.sample-batch-head,
.sample-batch-metrics,
.sample-batch-messages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sample-batch-head {
  justify-content: space-between;
  margin-bottom: 8px;
}

.sample-batch-head strong {
  color: var(--text);
}

.sample-batch-head span,
.sample-batch-metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sample-batch-messages {
  margin: 8px 0;
}

.sample-batch-messages em {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--surface-subtle);
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
}

.sample-batch-list {
  display: grid;
  gap: 7px;
}

.sample-batch-list article {
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.sample-batch-list b,
.sample-batch-list span {
  display: block;
}

.sample-batch-list b {
  color: var(--text);
  font-weight: 700;
}

.sample-batch-list span {
  margin-top: 3px;
  color: var(--muted);
}

.template-form {
  padding: 16px;
}

.form-actions .primary-action {
  width: auto;
}

#variableRules,
#answerRule,
#importTemplatesJson {
  font-family: "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 1.55;
}

#stemTemplate {
  min-height: 96px;
}

.collection-import #importTemplatesJson {
  min-height: 460px;
}

.collection-status {
  width: min(1600px, calc(100% - 48px));
  margin: 0 auto 18px;
  padding: 0 0 8px;
}

.status-line {
  margin: 0 16px 16px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.collection-status {
  margin: 0 auto 18px;
  padding: 0 0 8px;
}

@media (max-width: 1280px) {
  .admin-workbench {
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  }

  .admin-review-workbench {
    grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  }

  .collection-workbench {
    grid-template-columns: minmax(300px, 0.95fr) minmax(420px, 1.05fr);
  }

  .collection-history {
    grid-column: 1 / -1;
  }

  .admin-insights {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    height: auto;
    max-height: none;
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .admin-workbench .admin-insights > * {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 10px 24px rgba(24, 34, 48, 0.06);
  }

  .admin-insights .import-panel,
  .admin-insights .import-history {
    grid-column: auto;
  }
}

@media (max-width: 980px) {
  .workspace,
  .generator-layout,
  .admin-layout,
  .admin-workbench,
  .collection-workbench {
    display: block;
  }

  .workspace {
    padding: 14px;
  }

  .control-rail {
    position: static;
    margin-bottom: 14px;
  }

  .preview-panel,
  .admin-detail,
  .collection-column,
  .admin-insights {
    margin-top: 14px;
  }

  .collection-column:first-child {
    margin-top: 0;
  }

  .queue-panel,
  .review-panel {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .admin-insights {
    display: grid;
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .panel-header,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .command-row {
    justify-content: flex-start;
  }

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

  .admin-filters {
    grid-template-columns: 1fr;
    width: 100%;
  }

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

  .collection-page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .library-flow {
    grid-template-columns: 1fr;
  }

  .collection-scope-filters {
    grid-template-columns: 1fr;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .topbar {
    height: auto;
    min-height: 60px;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .topnav {
    width: 100%;
  }

  .topnav a {
    flex: 1;
    text-align: center;
  }

  .file-import-row {
    grid-template-columns: 1fr;
  }

  .file-import-row .ghost-action {
    width: 100%;
  }

  .panel-header h1,
  .section-head h1 {
    font-size: 20px;
  }

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

@media print {
  @page {
    margin: 14mm 12mm;
  }

  .topbar,
  .control-rail,
  .paper-actions {
    display: none;
  }

  body {
    background: #fff;
    color: #111827;
  }

  .workspace,
  .generator-layout {
    display: block;
    padding: 0;
    width: 100%;
    max-width: none;
  }

  .preview-panel {
    border: 0;
    box-shadow: none;
    margin: 0;
    overflow: visible;
  }

  .panel-header {
    padding: 0 0 10px;
    border-bottom: 2px solid #111827;
  }

  .panel-header h1 {
    font-size: 22px;
  }

  .paper-meta {
    padding: 10px 0 2px;
  }

  .paper-output {
    padding: 0;
  }

  .question-row {
    break-inside: avoid;
    page-break-inside: avoid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
    padding: 12px 0;
  }

  .question-tags {
    display: none;
  }

  .answer-box {
    display: none;
    border-left-color: #111827;
    background: #fff;
    padding: 6px 0 0 10px;
  }

  .paper-output.answers-visible .answer-box {
    display: block;
  }
}
