:root {
  --navy: #081c36;
  --navy-2: #102b50;
  --blue: #155da8;
  --ink: #111827;
  --muted: #4b5563;
  --line: #cbd5e1;
  --soft: #f3f6fa;
  --white: #ffffff;
  --danger: #b91c1c;
  --focus: #2f6fcb;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --app-chrome-height: 96px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--white);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.boot {
  padding: 40px;
}

.topbar {
  background: var(--navy);
  color: var(--white);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 28px;
  row-gap: 10px;
  min-height: var(--app-chrome-height);
  padding: 14px 24px 10px;
}

.brand {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  min-width: 216px;
  color: var(--white);
  text-decoration: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  width: max-content;
}

.brand:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 4px;
}

.brand-lockup {
  display: grid;
  gap: 3px;
}

.brand-title {
  margin: 0;
  color: var(--white);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.05;
}

.brand-subtitle {
  color: #b8c8dc;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.auth-strip {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  justify-self: end;
  margin-left: 0;
}

.user-badge {
  color: #e7eef8;
  font-size: 14px;
}

.main-nav {
  grid-column: 1 / 3;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0;
  background: transparent;
  border: 0;
}

.nav-button {
  position: relative;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #dbe6f3;
  padding: 10px 0;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: color 0.16s ease;
}

.nav-button::after {
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  height: 2px;
  background: var(--white);
  content: "";
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.18s ease;
}

.nav-button:hover {
  color: var(--white);
}

.nav-button:hover::after,
.nav-button.active::after {
  transform: scaleX(1);
}

.nav-button.active {
  background: transparent;
  color: var(--white);
}

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

.side-panel {
  height: calc(100vh - var(--app-chrome-height));
  overflow-y: auto;
  background: #f8fafc;
  border-right: 1px solid var(--line);
  padding: 14px 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.35) transparent;
}

.side-panel::-webkit-scrollbar {
  width: 8px;
}

.side-panel::-webkit-scrollbar-track {
  background: transparent;
}

.side-panel::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.35);
  background-clip: content-box;
}

.content-panel {
  min-width: 0;
  background: var(--soft);
  padding: 18px 22px 36px;
}

.browse-panel {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--app-chrome-height));
  overflow: hidden;
}

.tests-page {
  min-height: calc(100vh - var(--app-chrome-height));
  background: var(--soft);
  padding: 18px 22px 36px;
}

.tests-grid {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.section-title {
  margin: 0 0 14px;
  color: var(--blue);
  font-size: 26px;
  font-weight: 400;
}

.compact-title {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 19px;
}

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--navy);
  font-weight: 600;
}

.panel-body {
  padding: 14px;
}

.stack {
  display: grid;
  gap: 12px;
}

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

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

.field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  align-items: stretch;
}

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

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

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.check-row input {
  width: 16px;
  height: 16px;
}

.check-field {
  min-height: 82px;
  align-content: start;
}

.question-code-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f8fbff;
  padding: 9px 11px;
  color: var(--navy);
}

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

.question-code-preview strong {
  font-weight: 600;
}

.field label {
  color: var(--navy);
  font-size: 13px;
  font-weight: 600;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid #c8d1dd;
  border-radius: 3px;
  background: var(--white);
  color: var(--ink);
  padding: 9px 10px;
}

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

.input:focus,
.select:focus,
.textarea:focus {
  outline: 2px solid rgba(47, 111, 203, 0.25);
  border-color: var(--focus);
}

.button {
  border: 1px solid var(--blue);
  border-radius: 3px;
  background: var(--white);
  color: var(--blue);
  min-height: 36px;
  padding: 7px 12px;
  font-weight: 600;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.button:hover:not(:disabled) {
  background: #edf5ff;
  box-shadow: none;
}

.button.primary {
  background: var(--blue);
  color: var(--white);
}

.button.primary:hover:not(:disabled) {
  border-color: #084f95;
  background: #084f95;
}

.button.navy {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

.button.navy:hover:not(:disabled) {
  border-color: #102b55;
  background: #102b55;
}

.button.ghost {
  border-color: transparent;
  background: transparent;
  color: inherit;
}

.button.ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

.button.danger {
  border-color: #ef4444;
  color: var(--danger);
}

.button.danger:hover:not(:disabled) {
  background: #fff1f2;
}

.button.small {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

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

.button.added,
.button.added:disabled {
  border-color: #cbd5e1;
  background: #e5e7eb;
  color: #475569;
  opacity: 1;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  background: var(--white);
}

.segment {
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--white);
  color: var(--navy);
  padding: 8px 12px;
  font-weight: 600;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.segment:hover {
  background: #edf5ff;
}

.segment:last-child {
  border-right: 0;
}

.segment.active {
  background: var(--navy);
  color: var(--white);
}

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

.question-item {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--white);
  overflow: hidden;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.question-item.active {
  border-color: var(--blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

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

.question-item-clickable:hover {
  border-color: var(--blue);
  background: #f7faff;
}

.question-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px 4px;
  border-bottom: 0;
  color: var(--navy);
  font-weight: 600;
}

.question-item-header-meta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.question-item-marks {
  color: var(--ink);
  font-weight: 500;
}

.question-item-body {
  padding: 0 11px 10px;
  line-height: 1.45;
}

.question-item-summary {
  color: var(--ink);
  font-weight: 400;
  line-height: 1.35;
}

.question-item-meta {
  display: block;
  line-height: 1.35;
}

.admin-tabs {
  display: flex;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  margin: 8px 0 14px;
}

.admin-tab {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 0;
  font-weight: 600;
}

.admin-tab::after {
  content: "";
  position: absolute;
  left: 50%;
  right: 50%;
  bottom: -1px;
  height: 2px;
  background: var(--blue);
  transition: left 0.18s ease, right 0.18s ease;
}

.admin-tab:hover::after,
.admin-tab.active::after {
  left: 0;
  right: 0;
}

.admin-tab.active {
  color: var(--navy);
}

.admin-manager-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  align-items: start;
  min-height: 0;
}

.manager-filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(120px, 0.8fr) minmax(140px, 0.9fr) minmax(180px, 1.2fr);
  gap: 10px;
  align-items: end;
}

.admin-question-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 330px);
  overflow: auto;
  padding-right: 4px;
  align-content: start;
}

.admin-question-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--white);
  padding: 10px;
}

.admin-question-title {
  color: var(--navy);
  font-weight: 600;
}

.admin-question-summary {
  margin-top: 4px;
  color: var(--ink);
}

.added-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 18px;
  height: 18px;
  padding: 0;
  background: #f8fafc;
  color: var(--muted);
}

.added-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid currentColor;
}

.added-status.is-added {
  border-color: rgba(11, 92, 173, 0.25);
  background: #edf5ff;
  color: var(--blue);
}

.added-status.is-added .added-status-dot {
  background: currentColor;
}

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

.logo-preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f8fbff;
  padding: 8px 10px;
}

.logo-preview-row img {
  height: 34px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

.compact-create-list {
  gap: 10px;
}

.advanced-details {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f8fbff;
  padding: 0;
}

.advanced-details summary {
  cursor: pointer;
  color: var(--navy);
  font-weight: 600;
  padding: 10px 12px;
}

.advanced-details[open] summary {
  border-bottom: 1px solid var(--line);
}

.advanced-details-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--navy);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
}

.tag.navy { background: var(--navy); }
.tag.blue { background: var(--blue); }
.tag.teal { background: #0f766e; }
.tag.green { background: #166534; }
.tag.gold { background: #a16207; }
.tag.orange { background: #c2410c; }
.tag.red { background: #b91c1c; }
.tag.slate { background: #475569; }

.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.color-dot {
  width: 28px;
  height: 28px;
  border: 2px solid transparent;
  border-radius: 50%;
}

.color-dot.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--ink);
}

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

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--white);
  padding: 9px;
  text-align: left;
}

.set-row.active {
  border-color: var(--blue);
  background: #edf5ff;
}

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

.search-panel {
  flex: 0 0 auto;
}

.browse-workspace {
  display: grid;
  grid-template-columns: minmax(250px, 25%) minmax(0, 1fr);
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 16px;
  overflow: hidden;
}

.browse-results-panel,
.browse-viewer-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.browse-results-list,
.browse-viewer-body {
  min-height: 0;
  overflow-y: auto;
}

.browse-results-list {
  flex: 1 1 auto;
  max-height: 100%;
  padding: 8px;
  align-content: start;
  grid-auto-rows: max-content;
}

.browse-results-list .question-item-body .row-between {
  align-items: flex-start;
  flex-direction: column;
}

.browse-results-list .question-item-body .row {
  justify-content: flex-end;
  width: 100%;
}

.browse-viewer-header {
  flex-wrap: wrap;
}

.browse-viewer-body {
  flex: 1 1 auto;
  padding: 12px;
  background: #f8fbff;
}

.browse-viewer-body .viewer-paper {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: none;
}

.thin-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.45) transparent;
}

.thin-scrollbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.thin-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.thin-scrollbar::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.45);
  background-clip: content-box;
}

.thin-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.65);
  background-clip: content-box;
}

.viewer-paper {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 22px;
  min-height: 380px;
  box-shadow: none;
}

.viewer-paper p {
  margin: 0 0 13px;
  line-height: 1.55;
}

.text-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.question-layout {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 48px;
  gap: 12px;
  align-items: start;
}

.question-number {
  font-weight: 700;
  line-height: 1.55;
}

.mark-cell {
  text-align: right;
  line-height: 1.55;
}

.part-line {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 42px;
  gap: 10px;
  margin-top: 18px;
  align-items: start;
}

.part-response {
  break-inside: avoid;
}

.part-line.part-level-number,
.part-response.part-level-number {
  margin-left: 0;
}

.part-line.part-level-letter,
.part-response.part-level-letter {
  margin-left: 0;
}

.part-line.part-level-roman,
.part-response.part-level-roman {
  margin-left: 24px;
}

.part-response .part-line {
  margin-left: 0;
}

.part-nested-start {
  margin-left: 0;
}

.nested-part-content {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
}

.export-question-layout .part-line {
  margin-top: 14px;
}

.export-saq {
  display: grid;
  gap: 14px;
}

.export-saq-row,
.export-answer-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 48px;
  gap: 12px;
  align-items: start;
}

.export-part-response {
  break-inside: avoid;
}

.export-part-content {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
}

.export-part-content.part-level-number {
  margin-left: 0;
}

.export-part-content.part-level-letter {
  margin-left: 0;
}

.export-part-content.part-level-roman {
  grid-template-columns: 42px minmax(0, 1fr);
  margin-left: 58px;
}

.export-part-content.part-nested-start {
  grid-template-columns: 48px minmax(0, 1fr);
  margin-left: 0;
}

.export-answer-span {
  grid-column: 1 / 4;
}

.export-answer-span .answer-box,
.export-answer-span .calculation-space {
  margin-top: 8px;
  margin-bottom: 4px;
}

.list-answer-box {
  display: grid;
  gap: 12px;
}

.list-answer-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

.question-main > p:first-child {
  margin-top: 0;
}

.export-saq-row .question-main > p {
  margin: 0 0 6px;
  line-height: 1.35;
}

.export-saq-row .question-main > .block-image {
  margin: 6px 0 12px;
}

.export-saq-row .question-main > .block-image:first-child {
  margin-top: 0;
}

.export-saq-row .question-main > p + .block-image {
  margin-top: 6px;
}

.option-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.option-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
}

.block-image {
  margin: 8px 0 12px;
  text-align: center;
}

.block-image img {
  max-width: min(100%, 520px);
  max-height: 320px;
  object-fit: contain;
}

.caption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.markscheme-box {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fbfdff;
  padding: 14px;
  line-height: 1.55;
}

.rich-editor {
  display: grid;
  gap: 10px;
}

.block-add-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.75fr);
  gap: 12px;
  align-items: start;
  border: 1px dashed #b7c5d8;
  border-radius: 3px;
  background: #f8fbff;
  padding: 12px;
}

.saq-flow-add-grid {
  align-items: start;
}

.saq-part-control-grid {
  grid-template-columns: repeat(2, minmax(140px, 1fr));
}

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

.block-row,
.part-row,
.selected-question {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--white);
  padding: 9px 10px;
}

.block-row {
  display: grid;
  gap: 10px;
}

.saq-part-edit-form {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.nested-rich-editor {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f8fbff;
  padding: 10px;
}

.selected-question {
  display: grid;
  gap: 6px;
}

.selected-question .row-between {
  align-items: flex-start;
  gap: 8px;
}

.selected-question-title {
  color: var(--navy);
  font-weight: 600;
}

.selected-question-preview {
  color: var(--ink);
  line-height: 1.35;
}

.selected-question-controls {
  gap: 6px;
}

.selected-question-clickable {
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.selected-question-clickable:hover,
.selected-question.active {
  border-color: var(--blue);
  background: #f7faff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.builder-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 26, 58, 0.45);
}

.modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.2);
}

.modal.large {
  width: min(920px, 100%);
}

.export-menu-modal {
  width: min(620px, 100%);
  overflow: hidden;
}

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

.modal-body {
  padding: 18px;
}

.export-menu-modal .modal-body {
  max-height: calc(100vh - 120px);
  overflow: auto;
  scrollbar-width: none;
}

.export-menu-modal .modal-body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.export-link-list {
  display: grid;
  gap: 8px;
}

.export-link-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f8fbff;
  color: var(--blue);
  padding: 11px 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.export-link-list a:hover {
  border-color: var(--blue);
  background: #edf5ff;
}

.export-link-list small {
  color: var(--muted);
  font-size: 12px;
}

.distribution-card {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f8fbff;
  padding: 11px;
}

.distribution-title {
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
}

.distribution-bars {
  display: grid;
  gap: 7px;
}

.distribution-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  font-size: 12px;
}

.distribution-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe5f1;
}

.distribution-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.set-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  color: var(--navy);
  font-weight: 600;
}

.set-paper-workspace {
  display: grid;
  grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.set-question-order-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f8fbff;
  padding: 12px;
}

.set-question-order-list {
  display: grid;
  max-height: min(78vh, 820px);
  overflow-y: auto;
  gap: 8px;
  padding-right: 2px;
}

.set-question-order-list .selected-question {
  gap: 5px;
  padding: 8px 9px;
}

.set-question-order-list .selected-question-controls {
  gap: 4px;
}

.set-question-order-list .button.small {
  min-height: 26px;
  padding: 3px 7px;
}

.set-paper-preview {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #f8fbff;
  padding: 14px;
}

.paper-preview-sheet {
  display: grid;
  max-height: min(78vh, 820px);
  overflow-y: auto;
  gap: 22px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--white);
  padding: 22px;
}

.paper-preview-doc {
  display: grid;
  gap: 18px;
}

.paper-preview-doc h3 {
  margin: 0;
  border-bottom: 1px solid #111;
  padding-bottom: 8px;
  color: #000;
  font-size: 18px;
}

.error {
  border: 1px solid #fecaca;
  border-radius: 3px;
  background: #fff1f2;
  color: var(--danger);
  padding: 9px 10px;
}

.notice {
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  background: #f8fafc;
  color: var(--navy);
  padding: 9px 10px;
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 80;
  width: min(520px, calc(100vw - 32px));
  transform: translateX(-50%);
  border: 1px solid #fecaca;
  border-radius: 7px;
  background: #fff1f2;
  color: var(--danger);
  box-shadow: 0 16px 50px rgba(7, 26, 58, 0.2);
  padding: 12px 14px;
  text-align: center;
  font-weight: 700;
}

.toast.success {
  border-color: #86efac;
  background: #f0fdf4;
  color: #14532d;
}

.toast.info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: var(--navy);
}

.builder-preview {
  margin-top: 0;
  min-height: 0;
}

.success-notice {
  margin: 12px 0 14px;
  border-color: #86efac;
  background: #f0fdf4;
  color: #14532d;
}

.save-error {
  margin: 12px 0 14px;
}

.export-sheet {
  background: var(--white);
  color: #000000;
  font-family: Arial, Helvetica, sans-serif;
  padding: 28px;
}

.export-sheet p {
  margin: 0 0 13px;
  line-height: 1.55;
}

.export-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid #000000;
  padding-bottom: 10px;
  margin-bottom: 22px;
}

.export-title {
  margin: 0;
  font-size: 20px;
}

.answer-box {
  border: 1px solid #000000;
  margin: 12px 0 18px;
  padding: 12px 16px 15px;
}

.answer-line {
  border-bottom: 1px dotted #000000;
  height: 28px;
}

.calculation-space {
  position: relative;
  height: 112px;
  border: 1px solid #000000;
  margin: 12px 0 18px;
}

.calculation-final-line {
  position: absolute;
  right: 16px;
  bottom: 15px;
  width: 160px;
  border-bottom: 1px solid #000000;
}

.ib-export-documents {
  display: grid;
  gap: 28px;
}

.ib-document {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.ib-document-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 794px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--white);
  padding: 12px 14px;
}

.ib-document-toolbar h3 {
  margin: 0;
  color: var(--navy);
}

.ib-page {
  position: relative;
  width: 794px;
  min-height: 1123px;
  overflow: hidden;
  background: #ffffff;
  color: #000000;
  box-shadow: 0 8px 28px rgba(7, 26, 58, 0.15);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  page-break-after: always;
}

.ib-page-body {
  position: relative;
  z-index: 1;
  padding: 104px 76px 124px;
}

.ib-page.front-page .ib-page-body {
  padding-top: 94px;
}

.ib-page.back-page .ib-page-body,
.ib-page.blank-page .ib-page-body {
  padding-top: 94px;
}

.paper-legal {
  display: none !important;
}

.ib-page.continued-page .ib-page-body {
  padding-top: 95px;
}

.dot-strip {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28px;
  overflow: hidden;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width%3D'28'%20height%3D'6.75'%20viewBox%3D'0%200%2028%206.75'%3E%3Crect%20x%3D'-1.4'%20y%3D'0.75'%20width%3D'2.9'%20height%3D'0.6'%20fill%3D'%23111'%2F%3E%3Crect%20x%3D'2.22'%20y%3D'0.75'%20width%3D'2.9'%20height%3D'0.6'%20fill%3D'%23111'%2F%3E%3Crect%20x%3D'5.84'%20y%3D'0.75'%20width%3D'2.9'%20height%3D'0.6'%20fill%3D'%23111'%2F%3E%3Crect%20x%3D'9.46'%20y%3D'0.75'%20width%3D'2.9'%20height%3D'0.6'%20fill%3D'%23111'%2F%3E%3Crect%20x%3D'13.08'%20y%3D'0.75'%20width%3D'2.9'%20height%3D'0.6'%20fill%3D'%23111'%2F%3E%3Crect%20x%3D'16.7'%20y%3D'0.75'%20width%3D'2.9'%20height%3D'0.6'%20fill%3D'%23111'%2F%3E%3Crect%20x%3D'20.32'%20y%3D'0.75'%20width%3D'2.9'%20height%3D'0.6'%20fill%3D'%23111'%2F%3E%3Crect%20x%3D'23.94'%20y%3D'0.75'%20width%3D'2.9'%20height%3D'0.6'%20fill%3D'%23111'%2F%3E%3Crect%20x%3D'1.13'%20y%3D'4.13'%20width%3D'2.9'%20height%3D'0.6'%20fill%3D'%23111'%2F%3E%3Crect%20x%3D'4.75'%20y%3D'4.13'%20width%3D'2.9'%20height%3D'0.6'%20fill%3D'%23111'%2F%3E%3Crect%20x%3D'8.37'%20y%3D'4.13'%20width%3D'2.9'%20height%3D'0.6'%20fill%3D'%23111'%2F%3E%3Crect%20x%3D'11.99'%20y%3D'4.13'%20width%3D'2.9'%20height%3D'0.6'%20fill%3D'%23111'%2F%3E%3Crect%20x%3D'15.61'%20y%3D'4.13'%20width%3D'2.9'%20height%3D'0.6'%20fill%3D'%23111'%2F%3E%3Crect%20x%3D'19.23'%20y%3D'4.13'%20width%3D'2.9'%20height%3D'0.6'%20fill%3D'%23111'%2F%3E%3Crect%20x%3D'22.85'%20y%3D'4.13'%20width%3D'2.9'%20height%3D'0.6'%20fill%3D'%23111'%2F%3E%3Crect%20x%3D'26.47'%20y%3D'4.13'%20width%3D'2.9'%20height%3D'0.6'%20fill%3D'%23111'%2F%3E%3C%2Fsvg%3E");
  background-size: 28px 6.75px;
  background-repeat: repeat;
}

.ib-page.odd .dot-strip {
  left: 0;
  border-right: 1px solid #111;
}

.ib-page.even .dot-strip {
  right: 0;
  border-left: 1px solid #111;
}

.ib-page-header {
  position: absolute;
  top: 53px;
  left: 76px;
  right: 57px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  font-size: 12px;
}

.ib-page-header div:last-child {
  text-align: right;
}

.ib-page-footer {
  position: absolute;
  left: 76px;
  right: 57px;
  bottom: 51px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  min-height: 52px;
  font-size: 12px;
  font-weight: 700;
}

.ib-page-footer > div:last-child {
  text-align: right;
}

.barcode-block {
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 110px;
  font-size: 10px;
  font-weight: 400;
}

.barcode-svg {
  width: 96px;
  height: 44px;
  fill: #000000;
}

.corner {
  position: absolute;
  z-index: 3;
  width: 18px;
  height: 18px;
}

.corner-tl {
  top: 40px;
  left: 38px;
  border-top: 1px solid #111;
  border-left: 1px solid #111;
}

.corner-tr {
  top: 40px;
  right: 38px;
  border-top: 1px solid #111;
  border-right: 1px solid #111;
}

.corner-bl {
  bottom: 40px;
  left: 38px;
  border-bottom: 1px solid #111;
  border-left: 1px solid #111;
}

.corner-br {
  right: 38px;
  bottom: 40px;
  border-right: 1px solid #111;
  border-bottom: 1px solid #111;
}

.front-matter {
  position: relative;
  min-height: 900px;
  padding: 54px 36px 0;
  font-size: 14px;
}

.front-title {
  display: grid;
  gap: 4px;
  margin-bottom: 28px;
  font-size: 18px;
}

.front-logos {
  position: absolute;
  top: -54px;
  right: -20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  height: 64.35px;
  max-width: 540px;
}

.front-school-logo {
  display: block;
  width: auto;
  max-width: 235.4px;
  height: 64.35px;
  object-fit: contain;
}

.front-ib-logo {
  display: block;
  width: auto;
  max-width: 235.4px;
  height: 64.35px;
  object-fit: contain;
}

.front-meta,
.front-time {
  margin: 12px 0;
}

.name-box {
  position: absolute;
  top: 132px;
  right: 36px;
  display: grid;
  gap: 4px;
  width: 270px;
  text-align: center;
}

.name-line {
  height: 28px;
  border: 1px solid #111;
}

.front-matter hr {
  border: 0;
  border-top: 1px solid #111;
  margin: 10px 0 12px;
}

.front-matter ul {
  margin: 8px 0 0 18px;
  padding: 0;
  line-height: 1.35;
}

.front-page-count {
  position: absolute;
  left: 36px;
  bottom: 44px;
}

.blank-page-message {
  width: 260px;
  margin: 400px auto 0;
  border: 1px solid #111;
  padding: 18px 20px;
  text-align: center;
  font-size: 13px;
  line-height: 1.35;
}

.blank-page-message p {
  margin: 0 0 12px;
}

.blank-page-message p:last-child {
  margin-bottom: 0;
}

.back-matter {
  min-height: 860px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 18px;
  padding: 0 0 18px;
  font-size: 10px;
  line-height: 1.25;
}

.back-matter p {
  margin: 6px 0 0;
}

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

.reference-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
}

.reference-row p {
  margin: 0 0 4px;
}

.paper-instruction {
  font-size: 12px;
  margin-bottom: 24px !important;
}

.export-paper-question {
  break-inside: avoid;
  page-break-inside: avoid;
  margin-bottom: 18px;
}

.export-paper-question .question-layout {
  break-inside: avoid;
  page-break-inside: avoid;
}

.answer-box,
.calculation-space,
.export-part-response {
  break-inside: avoid;
  page-break-inside: avoid;
}

.continuation-label {
  margin: 0 0 18px;
  font-weight: 700;
}

.continuation-next {
  margin-top: 18px;
}

.print-only {
  display: none;
}

@media (max-width: 1000px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
  }

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

  .set-paper-workspace {
    grid-template-columns: 1fr;
  }

  .browse-panel {
    height: auto;
    min-height: calc(100vh - 145px);
    overflow: visible;
  }

  .browse-workspace {
    grid-template-columns: 1fr;
    height: auto;
  }

  .browse-results-list,
  .browse-viewer-body {
    max-height: 520px;
  }

  .test-edit-split {
    grid-template-columns: 1fr;
  }

  .side-panel {
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .field-grid,
  .form-grid,
  .block-add-grid,
  .manager-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.standalone-export {
  margin: 0;
  background: #f1f5f9;
  font-family: Arial, Helvetica, sans-serif;
}

.standalone-export-shell {
  display: grid;
  justify-items: center;
  gap: 24px;
  padding: 28px;
}

.standalone-export .ib-document-toolbar {
  display: none;
}

.standalone-sheet {
  width: min(900px, calc(100vw - 56px));
  min-height: calc(100vh - 56px);
  box-shadow: 0 8px 28px rgba(7, 26, 58, 0.15);
}

.answer-sheet-page {
  position: relative;
  width: 794px;
  min-height: 1123px;
  background: #fff;
  color: #000;
  box-shadow: 0 8px 28px rgba(7, 26, 58, 0.15);
  font-family: Arial, Helvetica, sans-serif;
  padding: 92px 72px;
}

.answer-sheet-id {
  position: absolute;
  top: 42px;
  right: 56px;
  font-size: 13px;
  font-weight: 400;
}

.answer-corner {
  position: absolute;
  width: 18px;
  height: 18px;
}

.answer-corner-tl {
  top: 40px;
  left: 40px;
  border-top: 1px solid #111;
  border-left: 1px solid #111;
}

.answer-corner-tr {
  top: 40px;
  right: 40px;
  border-top: 1px solid #111;
  border-right: 1px solid #111;
}

.answer-corner-bl {
  bottom: 40px;
  left: 40px;
  border-bottom: 1px solid #111;
  border-left: 1px solid #111;
}

.answer-corner-br {
  right: 40px;
  bottom: 40px;
  border-right: 1px solid #111;
  border-bottom: 1px solid #111;
}

.answer-sheet-form {
  display: grid;
  gap: 22px;
}

.answer-sheet-title {
  display: grid;
  gap: 5px;
  margin-bottom: 8px;
  text-align: center;
  font-size: 18px;
}

.answer-sheet-title span {
  font-size: 15px;
  font-weight: 400;
}

.answer-name-row,
.answer-level-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  font-size: 16px;
}

.answer-level-row {
  grid-template-columns: 100px auto 32px auto 32px;
  justify-content: start;
}

.answer-line-box {
  height: 34px;
  border: 2px solid #111;
}

.choice-box {
  width: 32px;
  height: 32px;
  border: 2px solid #111;
}

.choice-box.selected::after {
  content: "X";
  display: block;
  text-align: center;
  line-height: 28px;
  font-weight: 700;
}

.answer-instructions {
  border: 2px solid #111;
  padding: 12px 18px;
  font-size: 13px;
  line-height: 1.35;
}

.answer-instructions ol {
  margin: 8px 0 0 20px;
  padding: 0;
}

.answer-grid {
  display: grid;
  gap: 54px;
  align-items: start;
  justify-content: center;
  margin-top: 4px;
}

.answer-column {
  display: grid;
  gap: 9px;
}

.answer-choice-row {
  display: grid;
  grid-template-columns: 24px repeat(4, 32px);
  gap: 8px;
  align-items: center;
}

.answer-choice-box {
  display: grid;
  place-items: center;
  width: 32px;
  height: 28px;
  border: 1.5px solid #111;
  color: #c5cbd3;
  font-weight: 700;
}

.ms-document {
  display: grid;
  gap: 18px;
}

.ms-page {
  position: relative;
  width: 1123px;
  min-height: 794px;
  overflow: hidden;
  background: #fff;
  color: #000;
  box-shadow: 0 8px 28px rgba(7, 26, 58, 0.15);
  font-family: Arial, Helvetica, sans-serif;
  break-after: page;
  page-break-after: always;
}

.ms-front-page {
  display: grid;
  place-items: center;
}

.ms-identifier-left {
  position: absolute;
  top: 70px;
  left: 114px;
  font-size: 16px;
}

.ms-front-content {
  display: grid;
  gap: 42px;
  text-align: center;
}

.ms-front-content h1,
.ms-front-content h2 {
  margin: 0;
  font-weight: 800;
}

.ms-front-content h1 {
  font-size: 42px;
}

.ms-front-content h2 {
  font-size: 32px;
}

.ms-page-count {
  position: absolute;
  left: 114px;
  bottom: 92px;
  font-size: 14px;
}

.ms-page-header {
  position: absolute;
  top: 52px;
  left: 58px;
  right: 58px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  font-size: 16px;
}

.ms-page-header div:last-child {
  text-align: right;
}

.ms-guidance {
  padding: 112px 58px 60px;
  font-size: 16px;
  line-height: 1.25;
}

.ms-guidance ol {
  display: grid;
  gap: 13px;
  margin: 18px 0 0;
  padding-left: 38px;
}

.ms-guidance li {
  padding-left: 12px;
}

.ms-table-wrap {
  padding: 132px 58px 60px;
}

.ms-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 16px;
  line-height: 1.18;
}

.ms-col-q,
.ms-col-part,
.ms-col-subpart {
  width: 3.75%;
}

.ms-col-total {
  width: 4.5%;
}

.ms-col-answers {
  width: 42.125%;
}

.ms-col-notes {
  width: 42.125%;
}

.ms-table th,
.ms-table td {
  border: 1px solid #111;
  padding: 8px 6px;
  vertical-align: top;
}

.ms-table th {
  text-align: center;
  font-weight: 800;
}

.ms-q {
  font-weight: 700;
}

.ms-part {
  text-align: center;
  font-weight: 700;
}

.ms-subpart {
  text-align: center;
  font-weight: 700;
}

.ms-part-compound {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: 100%;
}

.ms-total {
  text-align: center !important;
  vertical-align: middle !important;
  font-weight: 800;
  line-height: 1.1;
}

.ms-table td:nth-child(5) {
  font-style: italic;
}

.ms-letter-line {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 2px;
  align-items: start;
}

.ms-letter-cont {
  margin-left: 24px;
}

.ms-bullet {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 4px;
}

.ms-or {
  margin: 2px 0;
  font-weight: 800;
  font-style: italic;
}

.ms-table p,
.muted-text {
  margin: 0 0 4px;
}

.muted-text {
  color: #6b7280;
}

@media (max-width: 640px) {
  .topbar-main,
  .side-panel,
  .content-panel,
  .tests-page {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    align-items: flex-start;
    gap: 12px;
  }

  .brand,
  .main-nav,
  .auth-strip {
    grid-column: 1;
  }

  .brand {
    grid-row: 1;
  }

  .main-nav {
    grid-row: 2;
  }

  .auth-strip {
    grid-row: 3;
    justify-self: start;
  }

  .brand-title {
    font-size: 22px;
  }

  .main-nav {
    max-width: 100%;
    overflow-x: auto;
  }

  .field-grid,
  .form-grid,
  .block-add-grid,
  .manager-filter-grid {
    grid-template-columns: 1fr;
  }

  .question-layout,
  .part-line {
    grid-template-columns: 1fr;
  }

  .mark-cell {
    text-align: left;
  }
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  @page markscheme {
    size: A4 landscape;
    margin: 0;
  }

  @page answer-sheet {
    size: A4;
    margin: 0;
  }

  body * {
    visibility: hidden;
  }

  .print-area,
  .print-area * {
    visibility: visible;
  }

  .print-area {
    position: absolute;
    inset: 0;
    display: block !important;
  }

  .no-print {
    display: none !important;
  }

  .modal-backdrop {
    position: static;
    display: block;
    padding: 0;
    background: transparent;
  }

  .modal {
    width: 100%;
    max-height: none;
    box-shadow: none;
    border-radius: 0;
  }

  .modal-header {
    display: none;
  }

  .modal-body {
    padding: 0;
  }

  .ib-document {
    display: none;
  }

  .ib-document.print-selected {
    display: grid;
    gap: 0;
  }

  .ib-document.print-selected,
  .ib-document.print-selected * {
    visibility: visible;
  }

  .standalone-export .standalone-sheet,
  .standalone-export .standalone-sheet * {
    visibility: visible;
  }

  .standalone-export .answer-sheet-page,
  .standalone-export .answer-sheet-page *,
  .standalone-export .ms-document,
  .standalone-export .ms-document * {
    visibility: visible;
  }

  .ib-document-toolbar {
    display: none;
  }

  .standalone-export-shell {
    padding: 0;
    gap: 0;
  }

  .standalone-export .ib-document {
    gap: 0;
  }

  .ms-document {
    gap: 0;
  }

  .ib-page {
    width: 210mm;
    min-height: 297mm;
    height: 297mm;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }

  .ib-page:last-child,
  .ib-document .ib-page:last-of-type {
    break-after: auto;
    page-break-after: auto;
  }

  .answer-sheet-page {
    page: answer-sheet;
    width: 210mm;
    min-height: 297mm;
    height: 297mm;
    box-shadow: none;
    break-after: auto;
    page-break-after: auto;
  }

  .ms-page {
    page: markscheme;
    width: 297mm;
    min-height: 210mm;
    height: 210mm;
    box-shadow: none;
  }

  .ms-page:last-child,
  .ms-document .ms-page:last-of-type {
    break-after: auto;
    page-break-after: auto;
  }
}
