:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: #182230;
  background: #f4f7fb;
  --ink: #182230;
  --ink-soft: #344054;
  --muted: #5d6b7d;
  --muted-strong: #475467;
  --page: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-blue: #f4f7ff;
  --border: #d1d9e6;
  --border-strong: #7c899b;
  --primary: #3157c8;
  --primary-hover: #2747a7;
  --primary-soft: #eaf0ff;
  --navy: #17233f;
  --navy-light: #243455;
  --success: #147a52;
  --success-soft: #e8f7f0;
  --warning: #9a5b00;
  --warning-soft: #fff6dc;
  --danger: #b42318;
  --danger-hover: #8e1b13;
  --danger-soft: #fff0ee;
  --info: #235eb5;
  --info-soft: #edf5ff;
  --radius-sm: 0.45rem;
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --shadow-sm: 0 1px 2px rgb(23 35 63 / 7%);
  --shadow: 0 10px 30px rgb(23 35 63 / 8%);
  --content-width: 1160px;
  --reading-width: 780px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 85% -10%, rgb(49 87 200 / 9%), transparent 28rem),
    var(--page);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button,
.button,
a,
input,
select,
textarea,
[contenteditable="true"],
summary {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--primary);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}

a:hover {
  color: var(--primary-hover);
}

img {
  max-width: 100%;
}

h1,
h2,
h3,
h4 {
  color: var(--ink);
  font-weight: 720;
  line-height: 1.22;
  text-wrap: balance;
}

h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.85rem, 4vw, 2.55rem);
  letter-spacing: -0.035em;
}

h2 {
  margin: 2rem 0 0.75rem;
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
  letter-spacing: -0.02em;
}

h3 {
  margin: 1.4rem 0 0.6rem;
  font-size: 1.15rem;
}

h4 {
  margin: 1.15rem 0 0.5rem;
  font-size: 1rem;
}

p {
  margin: 0.65rem 0 1rem;
}

ul,
ol {
  padding-left: 1.35rem;
}

li + li {
  margin-top: 0.35rem;
}

code,
pre,
.code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

pre {
  max-width: 100%;
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #101828;
  color: #f2f4f7;
  font-size: 0.875rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.75rem;
  z-index: 100;
  transform: translateY(-150%);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 0.65rem 0.9rem;
  box-shadow: var(--shadow);
  font-weight: 700;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: relative;
  z-index: 20;
  border-bottom: 1px solid rgb(255 255 255 / 10%);
  background: linear-gradient(135deg, var(--navy), #1d2e50);
  color: #fff;
  box-shadow: 0 4px 22px rgb(23 35 63 / 16%);
}

.site-header__inner {
  display: flex;
  min-height: 4.75rem;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  min-width: max-content;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  text-decoration: none;
}

.brand:hover {
  color: #fff;
}

.brand__mark {
  display: grid;
  width: 2.65rem;
  height: 2.65rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 24%);
  border-radius: 0.8rem;
  background: linear-gradient(145deg, #6f8ff0, #4167da);
  box-shadow: inset 0 1px rgb(255 255 255 / 20%);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand__copy {
  display: grid;
  gap: 0.05rem;
}

.brand__copy strong {
  color: #fff;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.brand__copy small {
  color: #bdc8dc;
  font-size: 0.75rem;
  font-weight: 550;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-nav a,
.nav-logout {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0.55rem;
  background: transparent;
  color: #dbe3f1;
  padding: 0.55rem 0.75rem;
  font-size: 0.91rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover,
.nav-logout:hover {
  background: rgb(255 255 255 / 9%);
  color: #fff;
}

.site-nav a[aria-current="page"] {
  background: rgb(255 255 255 / 14%);
  color: #fff;
  box-shadow: inset 0 -2px #86a1f2;
}

.site-nav form {
  margin: 0 0 0 0.25rem;
}

.nav-logout {
  border: 1px solid rgb(255 255 255 / 24%);
  cursor: pointer;
}

.page-shell {
  width: min(100%, calc(var(--content-width) + 2.5rem));
  min-height: calc(100vh - 4.75rem);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) 1.25rem 5rem;
}

.page-shell:focus {
  outline: none;
}

.page-shell--reading,
.public-context .page-shell {
  --content-width: 980px;
}

.public-context .page-shell.page-shell--reading {
  --content-width: 920px;
}

.page-shell--narrow {
  --content-width: 780px;
}

.page-header {
  display: flex;
  margin-bottom: 1.5rem;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}

.page-header__content {
  max-width: 780px;
}

.page-header__content > :last-child {
  margin-bottom: 0;
}

.page-header__actions,
.action-row,
.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.page-header__actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.eyebrow,
.element-label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.page-lead {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.65;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.meta-line > * + *::before {
  margin-right: 0.75rem;
  color: #9aa6b8;
  content: "•";
}

.muted {
  color: var(--muted);
}

.small,
small {
  font-size: 0.82rem;
}

.card {
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: clamp(1rem, 2.4vw, 1.5rem);
  box-shadow: var(--shadow-sm);
}

.card > :first-child {
  margin-top: 0;
}

.card > :last-child {
  margin-bottom: 0;
}

.card--soft {
  background: var(--surface-soft);
  box-shadow: none;
}

.card--highlight {
  border-color: #b8c8f5;
  background: var(--surface-blue);
}

.card__header {
  display: flex;
  margin-bottom: 1rem;
  padding-bottom: 0.9rem;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #e7ebf1;
}

.card__header h2,
.card__header h3 {
  margin: 0;
}

.narrow {
  max-width: 560px;
}

.centered {
  margin-right: auto;
  margin-left: auto;
}

.stack {
  display: grid;
  gap: 1rem;
}

.stack > * {
  margin-top: 0;
  margin-bottom: 0;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.36fr);
  gap: 1.25rem;
  align-items: start;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.summary-item {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.summary-item__label {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.summary-item__value {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.status-badge {
  display: inline-flex;
  min-height: 1.7rem;
  align-items: center;
  border: 1px solid #c7d1e0;
  border-radius: 999px;
  background: #f3f5f8;
  color: var(--ink-soft);
  padding: 0.18rem 0.58rem;
  font-size: 0.75rem;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
}

.status-badge--success,
.status-badge--finalized,
.status-badge--allow {
  border-color: #9bd5bd;
  background: var(--success-soft);
  color: #0c6543;
}

.status-badge--warning,
.status-badge--draft,
.status-badge--review {
  border-color: #e7ca80;
  background: var(--warning-soft);
  color: #7a4700;
}

.status-badge--info,
.status-badge--published {
  border-color: #afc9ef;
  background: var(--info-soft);
  color: #164d98;
}

.status-badge--danger,
.status-badge--block {
  border-color: #efb4ae;
  background: var(--danger-soft);
  color: #941f16;
}

.message-stack {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.message,
.notice,
.alert {
  position: relative;
  margin: 1rem 0;
  border: 1px solid #abc8ef;
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--info-soft);
  color: #173f78;
  padding: 0.9rem 1rem;
}

.message {
  margin: 0;
  box-shadow: var(--shadow-sm);
}

.message.success,
.alert--success {
  border-color: #95d0b7;
  background: var(--success-soft);
  color: #0b5e3f;
}

.message.warning,
.notice,
.alert--warning {
  border-color: #e4c36e;
  background: var(--warning-soft);
  color: #6e4304;
}

.message.error,
.alert--danger {
  border-color: #efa69f;
  background: var(--danger-soft);
  color: #8f2018;
}

.alert--info {
  border-color: #abc8ef;
  background: var(--info-soft);
  color: #173f78;
}

.notice > :first-child,
.alert > :first-child {
  margin-top: 0;
}

.notice > :last-child,
.alert > :last-child {
  margin-bottom: 0;
}

.error,
.errorlist {
  color: #9f1d15;
}

.errorlist {
  margin: 0.35rem 0 0.65rem;
  padding: 0;
  font-size: 0.86rem;
  font-weight: 650;
  list-style: none;
}

.errorlist li {
  margin: 0;
}

label,
legend {
  color: var(--ink-soft);
  font-weight: 680;
}

input,
select,
textarea {
  display: block;
  width: 100%;
  min-height: 2.8rem;
  margin: 0.35rem 0 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 0.65rem 0.75rem;
  box-shadow: inset 0 1px 2px rgb(23 35 63 / 4%);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

textarea {
  min-height: 7.5rem;
  line-height: 1.55;
  resize: vertical;
}

select {
  cursor: pointer;
}

input::placeholder,
textarea::placeholder {
  color: #6b778a;
  opacity: 1;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #728198;
}

input:disabled,
select:disabled,
textarea:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

input[type="checkbox"],
input[type="radio"] {
  display: inline-block;
  width: 1.1rem;
  min-height: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
  margin: 0.15rem 0;
  padding: 0;
  accent-color: var(--primary);
  box-shadow: none;
}

input[type="hidden"] {
  display: none !important;
}

input[type="file"] {
  min-height: auto;
  padding: 0.45rem;
  background: var(--surface-soft);
}

input[type="file"]::file-selector-button {
  margin-right: 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.35rem;
  background: var(--surface);
  color: var(--ink);
  padding: 0.45rem 0.65rem;
  font-weight: 650;
  cursor: pointer;
}

.field-row {
  margin: 0.8rem 0;
}

.field-row > input,
.field-row > select,
.field-row > textarea {
  margin-bottom: 0.35rem;
}

.field-row small,
.helptext {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.field-row--inline {
  display: grid;
  grid-template-columns: minmax(130px, 0.35fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}

.field-row--inline > * {
  margin-top: 0;
  margin-bottom: 0;
}

.checkbox-option,
.confirmation-option {
  display: flex;
  min-height: 2.75rem;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
}

.confirmation-option {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

button,
.button {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.55rem;
  background: var(--surface);
  color: var(--ink-soft);
  padding: 0.62rem 0.9rem;
  box-shadow: 0 1px 2px rgb(23 35 63 / 5%);
  font-weight: 680;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 120ms ease,
    box-shadow 120ms ease;
}

button:hover,
.button:hover {
  border-color: #7e8da2;
  background: #f8fafc;
  color: var(--ink);
  box-shadow: 0 2px 5px rgb(23 35 63 / 9%);
}

button:active,
.button:active {
  transform: translateY(1px);
}

button.primary,
.button.primary,
.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 5px rgb(49 87 200 / 20%);
}

button.primary:hover,
.button.primary:hover,
.primary:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
  color: #fff;
}

.button--quiet {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.button--small {
  min-height: 2.25rem;
  padding: 0.42rem 0.7rem;
  font-size: 0.84rem;
}

.danger-button,
button.danger-button,
.button.danger-button {
  border-color: #dca39d;
  background: #fff;
  color: var(--danger);
}

.danger-button:hover,
button.danger-button:hover,
.button.danger-button:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger-hover);
}

:focus-visible {
  outline: 3px solid rgb(78 118 225 / 38%);
  outline-offset: 2px;
}

input:focus,
select:focus,
textarea:focus,
[contenteditable="true"]:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgb(49 87 200 / 17%);
}

.inline {
  display: inline;
  margin: 0;
}

.table-wrap {
  width: 100%;
  margin: 1rem 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  scrollbar-width: thin;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.table-wrap table {
  margin: 0;
}

th,
td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #e3e8ef;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f7f9fc;
  color: var(--muted-strong);
  font-size: 0.75rem;
  font-weight: 780;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fafbfe;
}

.table-link {
  color: var(--ink);
  font-weight: 720;
  text-decoration: none;
}

.table-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.table-actions {
  text-align: right;
  white-space: nowrap;
}

.table-empty {
  padding: 2rem 1rem;
  color: var(--muted);
  text-align: center;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(150px, 1fr)) auto;
  gap: 0.75rem;
  margin: 1rem 0 1.25rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  align-items: end;
}

.filter-actions {
  display: flex;
  gap: 0.45rem;
}

.filter-actions > * {
  flex: 1 1 auto;
}

.filter-field {
  min-width: 0;
}

.filter-field label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--muted-strong);
  font-size: 0.78rem;
}

.filters input,
.filters select,
.filters button,
.filters .button {
  width: 100%;
  margin: 0;
}

.bulk-toolbar {
  display: flex;
  margin: 1rem 0 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.bulk-toolbar__selection {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.bulk-toolbar__selection label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
}

.empty-state {
  margin: 1rem 0;
  padding: 2.25rem 1.25rem;
  border: 1px dashed #aebacc;
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 65%);
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--ink);
  font-size: 1.05rem;
}

.rich-content {
  min-width: 0;
  overflow-wrap: anywhere;
}

.rich-content > :first-child {
  margin-top: 0;
}

.rich-content > :last-child {
  margin-bottom: 0;
}

.rich-content img,
.rich-text-editor img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 520px;
  margin: 1rem auto;
  border-radius: var(--radius);
  object-fit: contain;
}

.rich-content a {
  overflow-wrap: anywhere;
}

.rich-content li + li {
  margin-top: 0.25rem;
}

.theory-block {
  position: relative;
  margin: 1.25rem 0;
  border: 1px solid #c5d4ec;
  border-left: 5px solid #5674bb;
  border-radius: var(--radius);
  background: #f2f6fd;
  padding: 1.25rem 1.35rem;
}

.theory-block > :last-child,
.theory-block .rich-content > :last-child {
  margin-bottom: 0;
}

.question-card {
  margin: 1.25rem 0;
}

.question-heading {
  display: grid;
  grid-template-columns: 2.35rem minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
}

.question-number {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border-radius: 0.65rem;
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-size: 0.92rem;
  font-weight: 800;
}

.question-heading > .rich-content > :first-child {
  margin-top: 0.3rem;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.9rem 0 0;
}

.answer-panel {
  margin-top: 1rem;
  border-top: 1px solid #e4e8ef;
  padding-top: 1rem;
}

.answer-label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 780;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.answer-content {
  min-height: 2.5rem;
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 0.85rem 1rem;
}

.answer-content > :first-child {
  margin-top: 0;
}

.answer-content > :last-child {
  margin-bottom: 0;
}

.required {
  display: inline-flex;
  margin: 0.7rem 0 0.35rem;
  border-radius: 999px;
  background: var(--danger-soft);
  color: #8f2018;
  padding: 0.18rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 750;
}

.score-panel {
  margin-top: 1rem;
  border: 1px solid #b8cfef;
  border-radius: var(--radius);
  background: var(--info-soft);
  color: #173f78;
  padding: 0.85rem 1rem;
}

.score-panel--correct {
  border-color: #9bd5bd;
  background: var(--success-soft);
  color: #0c6543;
}

.score-panel--partial {
  border-color: #e7ca80;
  background: var(--warning-soft);
  color: #704200;
}

.score-panel > :first-child {
  margin-top: 0;
}

.score-panel > :last-child {
  margin-bottom: 0;
}

.answer-choice-group {
  display: grid;
  gap: 0.6rem;
  margin: 0.75rem 0 1rem;
  padding: 0;
  border: 0;
}

.answer-choice-option {
  display: flex;
  min-height: 3.25rem;
  align-items: flex-start;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.8rem 0.9rem;
  cursor: pointer;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    box-shadow 120ms ease;
}

.answer-choice-option:hover {
  border-color: #8090a8;
  background: #fafbfe;
}

.answer-choice-option:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(49 87 200 / 16%);
}

.answer-choice-option:has(input:checked) {
  border-color: #7793e2;
  background: var(--primary-soft);
}

.numeric-answer-control {
  display: flex;
  max-width: 520px;
  align-items: center;
  gap: 0.65rem;
}

.numeric-answer-control input {
  margin-bottom: 1rem;
}

.numeric-unit {
  margin-bottom: 0.7rem;
  color: var(--ink-soft);
  font-weight: 750;
  white-space: nowrap;
}

.submission-actions,
.editor-save-bar {
  position: sticky;
  bottom: 0.75rem;
  z-index: 10;
  display: flex;
  margin: 1.4rem 0 1.8rem;
  border: 1px solid #bfcadc;
  border-radius: var(--radius);
  background: rgb(255 255 255 / 94%);
  padding: 0.85rem 1rem;
  box-shadow: 0 -6px 26px rgb(23 35 63 / 12%);
  backdrop-filter: blur(10px);
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.submission-actions__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.progress-card {
  border-color: #c9d4e4;
  background: #f9fbfd;
}

.progress-card__icon {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border-radius: 0.7rem;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
}

.danger-zone {
  margin: 1.5rem 0;
  border: 1px solid #e0aaa4;
  border-left: 4px solid var(--danger);
  border-radius: var(--radius);
  background: #fffafa;
  padding: 1.15rem;
}

.danger-zone h2 {
  margin-top: 0;
  color: #8f2018;
}

.danger-zone.narrow {
  max-width: 560px;
}

.danger-zone .field-row {
  max-width: 390px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.gallery img {
  display: block;
  width: 100%;
  height: 180px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f0f2f5;
  object-fit: contain;
}

.gallery-item {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.gallery-item img {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.gallery-item__actions {
  padding: 0.65rem;
}

.code {
  display: inline-block;
  border: 1px solid #bdc8d7;
  border-radius: 0.4rem;
  background: #f5f7fa;
  padding: 0.15rem 0.4rem;
  color: var(--ink);
  font-size: 1.05em;
  overflow-wrap: anywhere;
}

details {
  margin: 1rem 0;
}

details > summary {
  border-radius: 0.35rem;
  color: var(--ink-soft);
  font-weight: 720;
  cursor: pointer;
}

details > summary:hover {
  color: var(--primary);
}

.advanced-settings,
.task-image-library {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem;
}

.advanced-settings > summary,
.task-image-library > summary {
  font-weight: 750;
}

.advanced-settings[open] > summary,
.task-image-library[open] > summary {
  margin-bottom: 0.9rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid #e5e9ef;
}

.advanced-settings-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 2fr;
  gap: 1rem;
}

.task-basics-grid {
  display: grid;
  grid-template-columns: minmax(200px, 0.75fr) minmax(260px, 1.5fr);
  gap: 1rem;
}

.task-ai-settings .field-row {
  margin-bottom: 0;
}

.instruction-builder-heading {
  display: flex;
  margin: 2.5rem 0 1rem;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
}

.instruction-builder-heading h2,
.instruction-builder-heading p {
  margin-bottom: 0.25rem;
}

.instruction-add-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
}

.instruction-element {
  position: relative;
  overflow: hidden;
  border-left: 5px solid var(--success);
  padding: clamp(1rem, 2.5vw, 1.5rem);
}

.instruction-element::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, rgb(20 122 82 / 35%), transparent);
  content: "";
}

.instruction-element.is-theory {
  border-left-color: #5674bb;
  background: #f8faff;
}

.instruction-element.is-theory::before {
  background: linear-gradient(90deg, rgb(86 116 187 / 35%), transparent);
}

.instruction-element-header {
  display: flex;
  margin: 0 0 1.15rem;
  padding: 0 0 0.95rem;
  border-bottom: 1px solid #e1e6ed;
  background: transparent;
  color: inherit;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.instruction-element-header h3 {
  margin: 0.1rem 0 0;
}

.instruction-element-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.instruction-element-actions button {
  min-width: 2.65rem;
  padding-right: 0.65rem;
  padding-left: 0.65rem;
}

.compact-field {
  max-width: 440px;
}

.question-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  margin-top: 1rem;
  border: 1px solid #dce3ed;
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 1rem;
  gap: 0.7rem 1.25rem;
  align-items: start;
}

.question-options [data-answer-image-limit] {
  grid-column: 1 / -1;
  margin: 0;
}

.choice-editor,
.numeric-settings {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fcfdff;
  padding: 1rem;
}

.choice-editor h4,
.numeric-settings h4 {
  margin: 0.1rem 0;
}

.choice-editor-heading {
  display: flex;
  margin-bottom: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.choice-editor-heading p {
  margin: 0.35rem 0 0;
}

.choice-editor-row {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto auto;
  padding: 0.7rem 0;
  border-top: 1px solid #e1e6ed;
  align-items: center;
  gap: 0.65rem;
}

.choice-editor-row input[type="text"] {
  margin: 0;
}

.choice-number {
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  place-items: center;
  border-radius: 999px;
  background: #edf1f6;
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 780;
}

.choice-correct {
  display: flex;
  min-height: 2.6rem;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
}

.choice-row-actions {
  display: flex;
  gap: 0.3rem;
}

.choice-row-actions button {
  min-width: 2.35rem;
  min-height: 2.35rem;
  padding: 0.4rem 0.55rem;
}

.numeric-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 1rem;
}

.instruction-empty-state {
  text-align: center;
}

.editor-save-bar {
  margin-top: 1.5rem;
}

[data-save-status].is-dirty {
  color: var(--warning);
  font-weight: 720;
}

[data-draft-status].is-dirty {
  color: var(--warning);
  font-weight: 720;
}

.deleted-element-notice {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.instruction-element.is-deleted {
  border-left-color: #97a2b3;
  background: #f0f2f5;
}

.instruction-element.is-deleted > :not(.deleted-element-notice) {
  display: none;
}

.instruction-element.is-deleted .deleted-element-notice {
  display: flex;
}

.rich-text-control {
  margin: 0.35rem 0 1rem;
}

.rich-text-toolbar {
  display: flex;
  overflow-x: auto;
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: #eef2f7;
  padding: 0.45rem;
  align-items: center;
  gap: 0.35rem;
  scrollbar-width: thin;
}

.rich-text-toolbar button {
  min-height: 2.35rem;
  flex: 0 0 auto;
  padding: 0.4rem 0.58rem;
  background: #fff;
  font-size: 0.84rem;
  white-space: nowrap;
}

.rich-text-toolbar button[aria-pressed="true"] {
  border-color: var(--navy-light);
  background: var(--navy-light);
  color: #fff;
}

.toolbar-bold {
  font-weight: 850;
}

.toolbar-italic {
  font-style: italic;
}

.rich-text-upload-status {
  min-width: max-content;
  margin-left: auto;
  color: var(--muted-strong);
  font-size: 0.8rem;
}

.rich-text-editor {
  min-height: 10rem;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--surface);
  padding: 0.85rem;
  outline: none;
}

.rich-text-editor:empty::before {
  color: #6b778a;
  content: attr(data-placeholder);
  pointer-events: none;
}

.rich-text-editor[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgb(180 35 24 / 14%);
}

.rich-text-validation-error {
  display: block;
  margin-top: 0.4rem;
}

.rich-image-missing {
  color: var(--danger);
  font-style: italic;
}

.task-image-library {
  margin-top: 1.5rem;
}

.task-content-image {
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.task-content-image img {
  display: block;
  width: 100%;
  height: 180px;
  background: #f1f3f6;
  object-fit: contain;
}

.task-content-image figcaption {
  display: flex;
  padding: 0.65rem;
  align-items: center;
  gap: 0.45rem;
}

.task-content-image figcaption button {
  min-height: 2.3rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
}

.account-provider-status h2 {
  margin-top: 0;
}

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

.login-shell {
  display: grid;
  min-height: calc(100vh - 11rem);
  place-items: center;
}

.login-card {
  width: min(100%, 460px);
  margin: 0 auto;
}

.login-card__heading {
  margin-bottom: 1.35rem;
  text-align: center;
}

.login-card__heading p {
  color: var(--muted);
}

.completion-card {
  max-width: 720px;
  margin: 1rem auto;
  padding: clamp(1.5rem, 5vw, 2.5rem);
  text-align: center;
}

.completion-mark {
  display: grid;
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1rem;
  place-items: center;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 1.8rem;
  font-weight: 850;
}

.completion-mark--muted {
  background: #eef1f5;
  color: var(--muted-strong);
}

.settings-panel {
  width: 100%;
  max-width: 680px;
}

.access-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.access-card {
  height: 100%;
  margin-top: 0;
}

.step-number {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
}

.workflow-steps {
  margin: 0 0 2rem;
}

.workflow-steps ol {
  position: relative;
  display: grid;
  max-width: 580px;
  margin: 0 auto;
  padding: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
}

.workflow-steps ol::before {
  position: absolute;
  top: 1.05rem;
  right: 16.6%;
  left: 16.6%;
  height: 2px;
  background: var(--border);
  content: "";
}

.workflow-steps li {
  position: relative;
  z-index: 1;
  display: grid;
  margin: 0;
  color: var(--muted);
  place-items: center;
  gap: 0.35rem;
}

.workflow-steps li span {
  display: grid;
  width: 2.15rem;
  height: 2.15rem;
  place-items: center;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--page);
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 800;
}

.workflow-steps li strong {
  font-size: 0.8rem;
}

.workflow-steps li[aria-current="step"] {
  color: var(--primary);
}

.workflow-steps li[aria-current="step"] span {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.finding-grid,
.review-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.review-columns {
  margin-top: 1.25rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.review-columns > div {
  padding: 0.85rem;
  border: 1px solid #cad7ee;
  border-radius: var(--radius);
  background: rgb(255 255 255 / 58%);
}

.review-columns h3 {
  margin-top: 0;
}

.payload-editor {
  min-height: 28rem;
  border-color: #7c8aa0;
  background: #111827;
  color: #f3f4f6;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.55;
  tab-size: 2;
}

.payload-editor:focus {
  border-color: #86a1f2;
  box-shadow: 0 0 0 3px rgb(86 116 187 / 30%);
}

.question-heading h2,
.question-heading h3 {
  margin: 0 0 0.55rem;
}

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

[hidden],
.answer-setting-hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .site-header__inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.65rem;
  }

  .site-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    scrollbar-width: thin;
  }

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

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

  .filters > :first-child {
    grid-column: 1 / -1;
  }

  .filter-actions {
    align-self: end;
  }

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

  .teacher-table {
    min-width: 920px;
  }
}

@media (max-width: 720px) {
  html {
    scroll-behavior: auto;
  }

  .site-header__inner {
    padding: 0.65rem 1rem 0.75rem;
  }

  .brand__mark {
    width: 2.35rem;
    height: 2.35rem;
  }

  .site-nav {
    gap: 0.15rem;
  }

  .site-nav a,
  .nav-logout {
    min-height: 2.75rem;
    padding: 0.48rem 0.62rem;
    font-size: 0.84rem;
  }

  .page-shell {
    min-height: auto;
    padding: 1.35rem 1rem 4rem;
  }

  .page-header,
  .instruction-builder-heading,
  .choice-editor-heading,
  .card__header,
  .bulk-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header__actions,
  .instruction-add-actions {
    justify-content: stretch;
  }

  .page-header__actions > *,
  .instruction-add-actions > * {
    flex: 1 1 auto;
  }

  .summary-grid,
  .access-grid,
  .finding-grid,
  .review-columns,
  .task-basics-grid,
  .advanced-settings-grid,
  .question-options,
  .numeric-settings-grid,
  .filters {
    grid-template-columns: 1fr;
  }

  .filters > :first-child {
    grid-column: auto;
  }

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

  .field-row--inline {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .instruction-element-header {
    align-items: stretch;
    flex-direction: column;
  }

  .instruction-element-actions {
    justify-content: flex-start;
  }

  .choice-editor-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .choice-correct,
  .choice-row-actions {
    grid-column: 2;
  }

  .choice-row-actions {
    flex-wrap: wrap;
  }

  .question-heading {
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: 0.55rem;
  }

  .workflow-steps {
    margin-bottom: 1.5rem;
  }

  .workflow-steps li strong {
    font-size: 0.72rem;
  }

  .question-number {
    width: 1.9rem;
    height: 1.9rem;
  }

  .submission-actions,
  .editor-save-bar {
    bottom: 0.35rem;
    align-items: stretch;
    flex-direction: column;
  }

  .submission-actions__buttons {
    display: grid;
    grid-template-columns: 1fr;
  }

  .editor-save-bar button,
  .submission-actions__buttons > * {
    width: 100%;
  }

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

  .gallery img,
  .task-content-image img {
    height: auto;
    max-height: 280px;
  }

  .task-content-image figcaption {
    align-items: stretch;
    flex-direction: column;
  }

  .task-content-image figcaption form,
  .task-content-image figcaption button {
    width: 100%;
  }

  .rich-text-toolbar {
    box-shadow: inset -12px 0 12px -12px rgb(23 35 63 / 45%);
  }

  .rich-text-toolbar button {
    min-height: 2.7rem;
  }

  .rich-text-upload-status {
    margin-left: 0;
  }

  .table-wrap {
    margin-right: -0.15rem;
    margin-left: -0.15rem;
  }
}

@media (max-width: 460px) {
  .brand__copy small {
    display: none;
  }

  .site-nav {
    margin-right: -0.3rem;
    margin-left: -0.3rem;
  }

  .site-nav form {
    margin-left: 0;
  }

  .action-row > *,
  .button-row > * {
    width: 100%;
  }

  .meta-line {
    display: grid;
    gap: 0.25rem;
  }

  .meta-line > * + *::before {
    display: none;
  }
}

@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 (prefers-contrast: more) {
  :root {
    --border: #7f8da1;
    --border-strong: #56657b;
  }

  .muted,
  small,
  .field-row small,
  .helptext {
    color: #364152;
  }
}
