:root {
	--color-text-danger: #a32d2d;
	--color-text-warning: #854f0b;
	--color-text-success: #3b6d11;
	--color-text-info: #185fa5;
	--color-text-secondary: #5f5e5a;
	--color-background-danger: #fcebeb;
	--color-background-warning: #faeeda;
	--color-background-success: #eaf3de;
	--color-background-info: #e6f1fb;
	--color-background-secondary: #e0f6fa;
	--color-background-primary: #ffffff;
	--color-border-tertiary: rgba(0, 0, 0, 0.08);
	--color-border-secondary: rgba(0, 0, 0, 0.2);
	--color-border-primary: rgba(0, 0, 0, 0.4);
	--color-border-success: #639922;
	--color-border-danger: #e24b4a;
	--color-border-info: #378add;
	--color-border-warning: #ba7517;
	--font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	--border-radius-md: 8px;
	--border-radius-lg: 12px;
}


* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	background: #f0fafb;
	color: #1a1a18;
}

nav {
	background: #0f4c5c;
	padding: 12px 24px;
	display: flex;
	align-items: center;
	gap: 24px;
	flex-wrap: nowrap;
}



nav a {
	color: #fff;
	text-decoration: none;
	font-size: 14px;
	opacity: 0.7;
}

nav a:hover {
	opacity: 1;
}

nav .brand {
	font-weight: 500;
	opacity: 1;
	font-size: 15px;
}

.container {
	max-width: 960px;
	margin: 32px auto;
	padding: 0 24px;
}

h1 {
	font-size: 24px;
	font-weight: 500;
	margin-bottom: 24px;
}

h2 {
	font-size: 18px;
	font-weight: 500;
	margin-bottom: 16px;
}

.card {
	background: #fff;
	border: 0.5px solid rgba(0, 0, 0, 0.12);
	border-radius: 12px;
	padding: 20px 24px;
	margin-bottom: 16px;
}

.btn {
	display: inline-block;
	padding: 8px 16px;
	font-size: 13px;
	font-weight: 500;
	border-radius: 8px;
	cursor: pointer;
	border: 0.5px solid rgba(0, 0, 0, 0.2);
	background: #fff;
	color: #1a1a18;
	text-decoration: none;
	font-family: inherit;
}

.btn:hover {
	background: #e0f6fa;
}

.btn-primary {
	background: #0f4c5c;
	color: #fff;
	border-color: #0f4c5c;
}

.btn-primary:hover {
	opacity: 0.85;
	background: #0f4c5c;
}

.form-group {
	margin-bottom: 16px;
}

label {
	display: block;
	font-size: 11px;
	font-weight: 700;
	color: #0e7490;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-bottom: 6px;
}

input,
select,
textarea {
	width: 100%;
	padding: 8px 12px;
	font-size: 14px;
	border: 0.5px solid rgba(0, 0, 0, 0.2);
	border-radius: 8px;
	background: #fff;
	color: #1a1a18;
	font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
	outline: none;
	border-color: rgba(0, 0, 0, 0.4);
}

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

th {
	text-align: left;
	font-size: 11px;
	font-weight: 500;
	color: #5f5e5a;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 8px 0;
	border-bottom: 0.5px solid rgba(0, 0, 0, 0.2);
}

td {
	padding: 10px 0;
	border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
}

tr:last-child td {
	border-bottom: none;
}

.badge {
	display: inline-block;
	font-size: 11px;
	font-weight: 500;
	padding: 3px 8px;
	border-radius: 99px;
}

.badge-success {
	background: #eaf3de;
	color: #27500a;
}

.badge-warning {
	background: #faeeda;
	color: #633806;
}

.flash {
	padding: 10px 14px;
	border-radius: 8px;
	margin-bottom: 16px;
	font-size: 13px;
	background: #eaf3de;
	color: #27500a;
	border: 0.5px solid #639922;
}

.page-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 24px;
}

.page-header-meta {
	color: #5f5e5a;
	font-size: 14px;
	margin-top: 4px;
}

.brief-grade-layout {
	position: relative;
}

.brief-grade-layout-has-sidebar {
	display: grid;
	/* Narrow while every sidebar panel is collapsed — wide enough for the
	   longest short-summary word, so nothing clips. */
	grid-template-columns: minmax(0, 1fr) 186px;
	gap: 20px;
	align-items: start;
}

.brief-grade-layout-has-sidebar.sidebar-expanded {
	grid-template-columns: minmax(0, 1fr) 300px;
}

.brief-grade-main {
	min-width: 0;
}

.brief-grade-sidebar {
	min-width: 0;
	position: sticky;
	top: 76px;
	align-self: start;
	display: flex;
	flex-direction: column;
	gap: 16px;
	max-height: calc(100vh - 96px);
	overflow-y: auto;
}

.brief-grade-sidebar-card {
	flex: 0 0 auto;
	overflow-wrap: break-word;
}

.todo-short-summary {
	margin: 10px 0 0;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--color-text-danger);
}

.todo-short-summary ul {
	margin: 0;
	padding-left: 16px;
	display: grid;
	gap: 4px;
}

.todo-full-list {
	margin: 12px 0 0;
	padding-left: 18px;
	display: grid;
	gap: 6px;
	font-size: 12px;
	font-weight: 600;
	color: var(--color-text-danger);
}

.sidebar-card-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 10px;
}

.sidebar-card-header .btn-small {
	flex: 0 0 auto;
	padding: 3px 10px;
	font-size: 11px;
}

.blind-marking-note {
	margin: 10px 0 0;
	border-radius: 6px;
	border: 1px solid rgba(180, 83, 9, 0.28);
	background: #fffbeb;
	padding: 7px 9px;
	font-size: 11px;
	font-weight: 600;
	color: #92400e;
}

.form-row {
	display: grid;
	grid-template-columns: 120px 1fr;
	gap: 12px;
	align-items: end;
}

.form-actions {
	display: flex;
	gap: 8px;
	margin-top: 8px;
}

.empty-state {
	color: #5f5e5a;
	font-size: 14px;
}

.col-narrow {
	width: 100px;
}

.col-xnarrow {
	width: 60px;
}


/* nav improvements */
nav {
	box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

nav a.active {
	opacity: 1;
	border-bottom: 2px solid #fff;
	padding-bottom: 2px;
}

.site-nav {
	position: sticky;
	top: 0;
	z-index: 100;
}

.nav-links {
	display: flex;
	align-items: center;
	gap: 10px;
	/* Between the desktop layout and the hamburger breakpoint the bar used to
	   squeeze its items; let it wrap instead. */
	flex-wrap: wrap;
	min-width: 0;
}

.nav-link,
.nav-trigger {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
}

.nav-link {
	opacity: 0.9;
}

.nav-link:hover,
.nav-group[open] .nav-trigger,
.nav-trigger:hover {
	background: rgba(255, 255, 255, 0.08);
	opacity: 1;
}

.nav-group {
	position: relative;
}

.nav-group summary {
	list-style: none;
	color: #fff;
	cursor: pointer;
	opacity: 0.9;
}

.nav-group summary::-webkit-details-marker {
	display: none;
}

.nav-group summary::after {
	content: "▾";
	font-size: 10px;
	opacity: 0.7;
}

.nav-menu {
	position: absolute;
	top: calc(100% + 10px);
	left: 0;
	min-width: 190px;
	padding: 10px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 14px;
	background: #0c3d4a;
	box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
	display: flex;
	flex-direction: column;
	gap: 4px;
	opacity: 0;
	transform: translateY(-6px) scale(0.98);
	transform-origin: top left;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 160ms ease, transform 180ms ease, visibility 180ms ease;
	will-change: opacity, transform;
}

.nav-group[open] .nav-menu {
	opacity: 1;
	transform: translateY(0) scale(1);
	visibility: visible;
	pointer-events: auto;
}

.nav-group.is-closing .nav-menu {
	opacity: 0;
	transform: translateY(-4px) scale(0.985);
	visibility: hidden;
	pointer-events: none;
}

.nav-menu a {
	display: block;
	padding: 9px 10px;
	border-radius: 10px;
	font-size: 13px;
	opacity: 0.82;
}

.nav-menu a:hover {
	background: rgba(255, 255, 255, 0.07);
	opacity: 1;
}

/* table improvements */
tbody tr:hover {
	background: #f0fbfc;
}

tr.selected-row {
	background: #d8f3f8;
}

tr.selected-row:hover {
	background: #c4edf5;
}

.filter-help {
	margin: -6px 0 12px;
	font-size: 12px;
	color: #5f5e5a;
}

.entry-year-filter {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 14px;
}

.entry-year-filter label {
	margin: 0;
	font-size: 12px;
}

.entry-year-filter select {
	width: auto;
	min-width: 110px;
}

.export-filter-form .form-row {
	align-items: end;
}

.bulk-export-toolbar {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.bulk-export-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 12px;
}

.checkbox-card {
	display: grid;
	gap: 8px;
	padding: 14px 16px;
	border: 1px solid #a8d8e2;
	border-radius: 12px;
	background: #fff;
	cursor: pointer;
}

.checkbox-card:hover {
	background: #f0fbfc;
	border-color: #7cc0cc;
}

.checkbox-card input {
	width: 16px;
	height: 16px;
	margin: 0;
}

.checkbox-card-title {
	font-size: 14px;
	font-weight: 500;
	color: #1a1a18;
}

.checkbox-card-meta {
	font-size: 12px;
	color: #5f5e5a;
}

.checkbox-card-disabled {
	opacity: 0.6;
	cursor: not-allowed;
	background: #f0fbfc;
}

.filter-help a {
	color: #1a1a18;
	font-weight: 500;
	opacity: 1;
}

.filter-title-link {
	display: inline-block;
	color: #1a1a18;
	text-decoration: none;
	opacity: 1;
}

.filter-title-link:hover {
	text-decoration: underline;
}

td a.btn {
	padding: 4px 10px;
	font-size: 12px;
}

.compact-table th,
.compact-table td {
	font-size: 12px;
	padding: 8px;
}

/* badge improvements */
.badge-success {
	background: #eaf3de;
	color: #27500a;
}

.badge-warning {
	background: #faeeda;
	color: #633806;
}

.badge-inactive {
	background: #ebebeb;
	color: #5f5e5a;
}

/* card header row */
.card-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
	padding-bottom: 16px;
	border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
}

/* qualification count pill */
.count-pill {
	font-size: 12px;
	color: #0e6073;
	background: #e0f6fa;
	border-radius: 99px;
	padding: 2px 10px;
}

/* empty state improvement */
.empty-state {
	color: #5f5e5a;
	font-size: 14px;
	padding: 24px 0;
	text-align: center;
}

/* form improvements */
.form-card {
	max-width: 560px;
}

input::placeholder,
textarea::placeholder {
	color: #b4b2a9;
}

/* page meta text */
.text-muted {
	color: #5f5e5a;
	font-size: 13px;
}

/* table col alignment */
th,
td {
	vertical-align: middle;
}

.drag-handle {
	cursor: grab;
	color: #b4b2a9;
	width: 20px;
}

.drag-handle:active {
	cursor: grabbing;
}

.draggable-row:hover {
	background: #f0fbfc;
}

.sortable-ghost {
	opacity: 0.4;
	background: #e0f6fa;
}

.input-inline {
	padding: 4px 8px;
	font-size: 13px;
	border: 0.5px solid rgba(0, 0, 0, 0.15);
	border-radius: 6px;
	width: 100%;
}

.input-inline:focus {
	border-color: rgba(0, 0, 0, 0.4);
	outline: none;
}

.exam-paper-boundary-raw-threshold {
	padding-left: 16px;
}

.exam-paper-boundary-minimum {
	padding-left: 16px;
}

.exam-paper-question-report-table {
	background: #fff;
	font-size: 13px;
}

.exam-paper-question-report-table th,
.exam-paper-question-report-table td {
	padding: 6px 8px;
}

.exam-paper-question-report-table th:first-child,
.exam-paper-question-report-table td:first-child {
	width: 140px;
}

.exam-paper-question-report-table th:last-child,
.exam-paper-question-report-table td:last-child {
	width: 120px;
	text-align: right;
}

.exam-paper-question-setup-table {
	table-layout: fixed;
}

.exam-paper-question-setup-table th:nth-child(3),
.exam-paper-question-setup-table td:nth-child(3) {
	width: 90px;
}

.exam-paper-question-setup-table th:nth-child(4),
.exam-paper-question-setup-table td:nth-child(4) {
	width: 120px;
}

.exam-paper-question-setup-table th:nth-child(5),
.exam-paper-question-setup-table td:nth-child(5) {
	width: 170px;
}

.exam-paper-question-cell {
	cursor: text;
	vertical-align: top;
}

.exam-paper-question-view {
	min-height: 34px;
	white-space: pre-line;
}

.exam-paper-question-edit {
	display: none;
}

.exam-paper-question-row.is-editing .exam-paper-question-view {
	display: none;
}

.exam-paper-question-row.is-editing .exam-paper-question-edit {
	display: block;
}

.exam-paper-question-save-button {
	display: none;
}

.exam-paper-question-row.is-editing .exam-paper-question-save-button {
	display: inline-flex;
}

.exam-paper-question-row.is-editing .exam-paper-question-edit-button {
	display: none;
}

.exam-paper-question-max-input {
	max-width: 72px;
}

.exam-paper-question-add-form {
	display: grid;
	grid-template-columns: minmax(160px, 1fr) minmax(260px, 2fr) 86px auto;
	gap: 12px;
	align-items: start;
}

.exam-paper-question-add-form .form-group {
	margin-bottom: 0;
}

.exam-paper-question-add-form label {
	min-height: 18px;
}

.rich-text-wrapper {
	border: 0.5px solid var(--color-border-secondary);
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
}

.rich-text-toolbar {
	display: flex;
	gap: 4px;
	align-items: center;
	flex-wrap: wrap;
	padding: 6px;
	background: var(--color-background-secondary);
	border-bottom: 0.5px solid var(--color-border-tertiary);
}

.rich-text-toolbar .btn {
	min-width: 28px;
	justify-content: center;
}

.rich-text-editor {
	min-height: 140px;
	max-height: 320px;
	overflow: auto;
	padding: 10px 12px;
	font-size: 13px;
	line-height: 1.45;
	outline: none;
}

.rich-text-editor:empty::before {
	content: "Add context, instructions, source details, or other notes for this exam paper.";
	color: var(--color-text-tertiary);
}

.rich-text-editor table,
.exam-paper-exam-additional-notes table {
	width: 100%;
	border-collapse: collapse;
	margin: 8px 0;
}

.rich-text-editor th,
.rich-text-editor td,
.exam-paper-exam-additional-notes th,
.exam-paper-exam-additional-notes td {
	border: 1px solid var(--color-border-secondary);
	padding: 6px 8px;
	vertical-align: top;
}

.rich-text-editor th,
.exam-paper-exam-additional-notes th {
	background: var(--color-background-secondary);
	font-weight: 700;
}

.exam-paper-exam-additional-notes {
	margin-top: 6px;
	font-size: 12px;
	color: var(--color-text-secondary);
}

.input-inline-danger {
	background: var(--color-background-danger);
	border-color: var(--color-border-danger);
	color: var(--color-text-danger);
}

.input-inline-danger:focus {
	border-color: var(--color-border-danger);
	outline: none;
	box-shadow: 0 0 0 3px rgba(226, 75, 74, 0.14);
}

.input-inline-success {
	background: var(--color-background-success);
	border-color: var(--color-border-success);
	color: var(--color-text-success);
}

.input-inline-success:focus {
	border-color: var(--color-border-success);
	outline: none;
	box-shadow: 0 0 0 3px rgba(99, 153, 34, 0.14);
}

.btn-small {
	padding: 4px 10px;
	font-size: 12px;
}

.btn-danger {
	background: #fcebeb;
	color: #791f1f;
	border-color: #f09595;
}

.btn-danger:hover {
	background: #f7c1c1;
}

.form-row-three {
	display: grid;
	grid-template-columns: 160px auto 1fr;
	gap: 16px;
	align-items: end;
}

.role-toggle {
	display: inline-block;
	padding: 7px 14px;
	border: 1.5px solid #bbb;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 500;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	color: #888;
	background: #fff;
	transition: background 0.12s, color 0.12s, border-color 0.12s;
	user-select: none;
	margin-bottom: 0;
}

.role-toggle:hover {
	border-color: #888;
	color: #333;
	background: #f5f5f5;
}

.role-toggle-active {
	background: #0f4c5c;
	color: #fff;
	border-color: #0f4c5c;
}


/* BADGE COLOURS FOR GRADE SCALES */
.badge-green {
	background: #eaf3de;
	color: #27500a;
}

.badge-amber {
	background: #faeeda;
	color: #633806;
}

.badge-red {
	background: #fcebeb;
	color: #791f1f;
}

.badge-grey {
	background: #ebebeb;
	color: #5f5e5a;
}

.badge-blue {
	background: #e6f1fb;
	color: #0c447c;
}

.year-pill {
	display: inline-block;
	padding: 2px 9px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
}

td form {
	display: inline;
}

/* NAV USER STYLES */

.nav-user {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 16px;
}

.nav-user span {
	font-size: 13px;
	color: rgba(255, 255, 255, 0.7);
}

.nav-user a {
	font-size: 13px;
}

/* ── Hamburger button (hidden on desktop) ───────────────────────────────── */
.nav-hamburger {
	display: none;
	background: none;
	border: none;
	cursor: pointer;
	padding: 10px;
	border-radius: 8px;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.nav-hamburger:hover {
	background: rgba(255, 255, 255, 0.08);
}

.nav-hamburger-icon,
.nav-hamburger-icon::before,
.nav-hamburger-icon::after {
	display: block;
	width: 20px;
	height: 2px;
	background: #fff;
	border-radius: 2px;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-hamburger-icon {
	position: relative;
}

.nav-hamburger-icon::before,
.nav-hamburger-icon::after {
	content: '';
	position: absolute;
	left: 0;
}

.nav-hamburger-icon::before { top: -6px; }
.nav-hamburger-icon::after  { top:  6px; }

.site-nav.nav-open .nav-hamburger-icon { background: transparent; }
.site-nav.nav-open .nav-hamburger-icon::before { transform: rotate(45deg)  translate(4px, 4px); }
.site-nav.nav-open .nav-hamburger-icon::after  { transform: rotate(-45deg) translate(4px, -4px); }

/* ── Collapsible nav — iPad portrait and below (≤1024px) ────────────────── */
@media (max-width: 1024px) {
	.site-nav {
		flex-wrap: wrap;
		padding: 0 16px;
		gap: 0;
	}

	.brand {
		padding: 14px 0;
		margin-right: auto;
	}

	.nav-user {
		display: flex;
		align-items: center;
		gap: 12px;
		padding: 14px 0;
		margin-left: 0;
	}

	.nav-hamburger {
		display: flex;
		margin-left: 12px;
	}

	/* Nav links panel — JS controls display, CSS controls layout when open */
	.nav-links {
		order: 10;
		width: 100%;
		flex-direction: column;
		gap: 4px;
		padding: 8px 0 14px;
		border-top: 1px solid rgba(255, 255, 255, 0.1);
	}

	.site-nav:not(.nav-open) .nav-links {
		display: none !important;
	}

	.site-nav.nav-open .nav-links {
		display: flex !important;
	}

	.nav-link {
		width: 100%;
		border-radius: 8px;
		padding: 10px 12px;
	}

	.nav-group {
		width: 100%;
	}

	.nav-trigger {
		width: 100%;
		border-radius: 8px;
		padding: 10px 12px;
	}

	.nav-menu {
		position: static;
		width: 100%;
		box-shadow: none;
		background: rgba(255, 255, 255, 0.05);
		border: none;
		border-radius: 8px;
		margin-top: 4px;
		padding: 4px 8px;
		transform-origin: top center;
	}

	.nav-menu a {
		padding: 10px 10px;
		border-radius: 8px;
		min-height: 44px;
		display: flex;
		align-items: center;
	}
}

/* ── Layout stacking — portrait only (≤900px) ───────────────────────────── */
@media (max-width: 900px) {
	.students-layout {
		grid-template-columns: 1fr;
	}

	.students-sidebar {
		position: static;
	}
}


/* GRID STYLES for ASSIGNMENTS */
.grid-table {
	border-collapse: collapse;
	width: 100%;
	font-size: 13px;
}

.grid-table th {
	background: #e0f6fa;
	border: 1px solid #a8d8e2;
	padding: 6px 10px;
	text-align: left;
	font-size: 11px;
	font-weight: 500;
	color: #5f5e5a;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	position: sticky;
	top: 0;
	z-index: 1;
}

.grid-table th.sortable-header {
	cursor: pointer;
	user-select: none;
}

.grid-table th.sortable-header::after {
	content: " \2195";
	font-size: 10px;
	color: #0e7490;
	opacity: 0.55;
}

.grid-table th.sortable-header[data-sort-direction="asc"]::after {
	content: " \2191";
	opacity: 1;
}

.grid-table th.sortable-header[data-sort-direction="desc"]::after {
	content: " \2193";
	opacity: 1;
}

.grid-table td {
	border: 1px solid #cceef5;
	padding: 3px 6px;
	height: 32px;
}

.grid-table tbody tr:nth-child(even) {
	background: #f4fbfc;
}

.grid-table tbody tr:hover {
	background: #e0f6fa;
}

.grid-table .row-num {
	background: #e0f6fa;
	color: #0e7490;
	font-size: 11px;
	text-align: center;
	width: 32px;
	border-color: #a8d8e2;
}

.grid-select {
	width: 100%;
	border: none;
	background: transparent;
	font-size: 13px;
	color: #1a1a18;
	padding: 2px 4px;
	outline: none;
	cursor: pointer;
	height: 100%;
}

.grid-select:focus {
	background: #e6f1fb;
}

.grid-cell-name {
	font-size: 13px;
	color: #1a1a18;
	white-space: nowrap;
}

.grid-cell-muted {
	font-size: 12px;
	color: #5f5e5a;
	white-space: nowrap;
}

.grid-wrapper {
	overflow-x: auto;
	overflow-y: auto;
	border: 1px solid #a8d8e2;
	border-radius: 8px;
	flex: 1;
	min-height: 0;
}

.assignments-layout {
	display: grid;
	grid-template-columns: 300px 1fr;
	gap: 16px;
	align-items: start;
	height: calc(100vh - 140px);
	margin-left: calc(-1 * (100vw - 960px) / 2);
	margin-right: calc(-1 * (100vw - 960px) / 2);
	padding-left: 24px;
	padding-right: 24px;
	box-sizing: border-box;
	width: 100vw;
}

.assignments-main {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 0;
}

.assignments-sidebar {
	display: flex;
	flex-direction: column;
	gap: 16px;
	position: sticky;
	top: 16px;
	/* sidebar markup follows the main panel; order pulls it to the left column */
	order: -1;
}

.students-layout {
	display: grid;
	grid-template-columns: 1fr 300px;
	gap: 16px;
	align-items: start;
}

.students-main {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.students-sidebar {
	display: flex;
	flex-direction: column;
	gap: 16px;
	position: sticky;
	top: 16px;
}

.grid-select.unassigned {
	background: #fcebeb;
	color: #791f1f;
}

.marker-filter-link {
	cursor: pointer;
	font-weight: 500;
	color: var(--color-text-info);
}

.marker-filter-link:hover {
	text-decoration: underline;
}


/* GRADE BUTTONS IN THE GRADE FORM */
.grade-btn {
	padding: 6px 14px;
	font-size: 13px;
	font-weight: 500;
	border-radius: 8px;
	border: 0.5px solid var(--color-border-secondary);
	background: var(--color-background-primary);
	color: var(--color-text-secondary);
	cursor: pointer;
	transition: all 0.15s;
	white-space: nowrap;
}

.grade-btn.selected {
	background: var(--color-background-secondary);
	color: var(--color-text-primary);
	border-color: var(--color-border-primary);
}

.grade-btn.selected[data-colour="red"] {
	background: #f7c1c1;
	color: #791f1f;
	border-color: #e24b4a;
	font-weight: 500;
}

.grade-btn.selected[data-colour="amber"] {
	background: #fac775;
	color: #633806;
	border-color: #ba7517;
	font-weight: 500;
}

.grade-btn.selected[data-colour="green"] {
	background: #c0dd97;
	color: #27500a;
	border-color: #639922;
	font-weight: 500;
}

.grade-btn.selected[data-colour="blue"] {
	background: #b5d4f4;
	color: #0c447c;
	border-color: #378add;
	font-weight: 500;
}

.grade-btn.selected[data-colour="grey"] {
	background: #d3d1c7;
	color: #2c2c2a;
	border-color: #888780;
	font-weight: 500;
}

.grade-btn.selected-none {
	background: var(--color-background-secondary);
	color: var(--color-text-secondary);
	border-color: var(--color-border-secondary);
}

.grade-btn.grade-btn-locked {
	background: #f3f3f1;
	color: #8a8984;
	border-color: var(--color-border-tertiary);
	cursor: not-allowed;
	opacity: 0.58;
}

.grade-btn:disabled {
	background: #f3f3f1;
	color: #8a8984;
	border-color: var(--color-border-tertiary);
	cursor: not-allowed;
	opacity: 0.62;
}

/* Banded criterion grid — flooded marking strands */
.container.container-banded {
	max-width: 1840px;
}

/* Breathing room between columns: the base table style has no horizontal
   cell padding, which makes adjacent columns touch. */
.banded-grid-table th,
.banded-grid-table td {
	padding-right: 16px;
}

.banded-grid-table th:last-child,
.banded-grid-table td:last-child {
	padding-right: 0;
}

.banded-grid-table th.col-code,
.banded-grid-table td:first-child {
	width: auto;
	min-width: 190px;
	padding-right: 20px;
}

.banded-grid-table .grade-btn-group {
	display: grid;
	grid-template-columns: 1fr;
	gap: 6px;
	min-width: 116px;
}

.banded-grid-table .grade-btn {
	width: 100%;
	text-align: center;
	padding: 6px 10px;
}

.band-grid-cell {
	vertical-align: top;
	font-size: 12px;
	line-height: 1.7;
}

.strand {
	cursor: pointer;
	border-radius: 4px;
	padding: 1px 3px;
	transition: background 0.12s, color 0.12s;
}

.strand:hover {
	background: var(--color-background-secondary);
}

.strand[data-status="secure"] {
	background: #c0dd97;
	color: #27500a;
}

.strand[data-status="partial"] {
	background: #fac775;
	color: #633806;
}

.strand-retired {
	opacity: 0.65;
	text-decoration: line-through;
	cursor: default;
}

.band-grid-suggestion {
	font-size: 11px;
	margin-top: 6px;
	white-space: nowrap;
}

.grade-cap-callout {
	margin-top: 10px;
	padding: 10px 12px;
	border: 0.5px solid var(--color-border-warning);
	border-radius: 8px;
	background: var(--color-background-warning);
	color: var(--color-text-warning);
	font-size: 13px;
}

.col-code {
	width: 60px;
}

.col-description {
	width: 220px;
}

.grade-btn.selected-none {
	background: var(--color-background-secondary);
	color: var(--color-text-secondary);
	border-color: var(--color-border-secondary);
}


/* METRIC GRID STUDENT MARKING */
.metric-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 10px;
}

.metric {
	background: var(--color-background-secondary);
	border-radius: var(--border-radius-md);
	padding: 12px;
}

.metric-label {
	font-size: 11px;
	color: var(--color-text-secondary);
	margin-bottom: 4px;
}

.metric-value {
	font-size: 22px;
	font-weight: 500;
	color: var(--color-text-primary);
}

.metric-sub {
	font-size: 11px;
	color: var(--color-text-secondary);
	margin-top: 2px;
}

.badge-pending {
	background: var(--color-background-secondary);
	color: var(--color-text-secondary);
	border: 0.5px solid var(--color-border-secondary);
}


/* QUILL EDITOR */
.quill-wrapper {
	border: 0.5px solid var(--color-border-secondary);
	border-radius: 8px;
	overflow: hidden;
}

.quill-wrapper .ql-toolbar {
	border: none;
	border-bottom: 0.5px solid var(--color-border-tertiary);
	padding: 4px 8px;
	background: var(--color-background-secondary);
}

.quill-wrapper .ql-container {
	border: none;
	font-size: 13px;
	font-family: var(--font-sans);
	min-height: 60px;
	max-height: 200px;
	overflow-y: auto;
}

.quill-wrapper .ql-editor {
	padding: 6px 10px;
	min-height: 60px;
	max-height: 200px;
	overflow-y: auto;
	overflow-x: hidden;
	word-break: break-word;
	overflow-wrap: break-word;
	white-space: pre-wrap;
}

.comment-content a,
.quill-wrapper .ql-editor a {
	color: #0f8b8d;
	text-decoration-color: #0f8b8d;
}

.comment-content a:hover,
.quill-wrapper .ql-editor a:hover {
	color: #0c6f71;
	text-decoration-color: #0c6f71;
}

.quill-wrapper .ql-editor.ql-blank::before {
	font-style: normal;
	color: var(--color-text-tertiary);
	font-size: 13px;
}

.quill-wrapper .ql-toolbar {
	border: none;
	border-bottom: 0.5px solid var(--color-border-tertiary);
	padding: 2px 6px;
	background: var(--color-background-secondary);
}

.quill-wrapper .ql-toolbar .ql-formats {
	margin-right: 6px;
}

.quill-wrapper .ql-toolbar button {
	width: 20px;
	height: 20px;
	padding: 1px;
}

.quill-wrapper .ql-toolbar button svg {
	width: 14px;
	height: 14px;
}

.quill-wrapper .ql-toolbar .ql-picker {
	font-size: 11px;
}

.quill-wrapper.is-locked {
	background: #f3f3f1;
	border-color: var(--color-border-tertiary);
}

.quill-wrapper.is-locked .ql-container,
.quill-wrapper.is-locked .ql-editor {
	background: #f3f3f1;
	color: #77766f;
	cursor: not-allowed;
}

/* BADGE CONFLICT */
.badge-conflict {
	background: var(--color-background-danger);
	color: var(--color-text-danger);
}

.badge-green { background: #eaf3de; color: #27500a; }
.badge-amber { background: #faeeda; color: #633806; }
.badge-red { background: #fcebeb; color: #791f1f; }
.badge-grey { background: #ebebeb; color: #5f5e5a; }
.badge-blue { background: #e6f1fb; color: #0c447c; }


.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; background: #eaf3de; color: #27500a; border: 0.5px solid #639922; }
.flash-danger { background: #fcebeb; color: #791f1f; border-color: #e24b4a; }
.flash-warning { background: #faeeda; color: #633806; border-color: #ba7517; }
.flash-success { background: #eaf3de; color: #27500a; border-color: #639922; }

.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--color-background-secondary); }

.progress-grid-page {
	width: calc(100vw - 48px);
	margin-left: calc(50% - 50vw + 24px);
	margin-right: calc(50% - 50vw + 24px);
}

.progress-grid-shell {
	display: grid;
	grid-template-rows: auto 1fr;
	gap: 16px;
	min-height: calc(100vh - 150px);
}

.progress-grid-toolbar {
	display: grid;
	gap: 16px;
}

/* flex, not a fixed-column grid: filters can come and go (e.g. the
   pathway select only renders for pathway qualifications) without
   shifting every control into the wrong slot. Search is the one that
   grows. */
.progress-grid-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: flex-end;
}

.progress-grid-filters > div {
	flex: 0 1 180px;
	min-width: 140px;
}

.progress-grid-filters > .progress-control {
	flex: 0 1 240px;
}

.progress-grid-filters > .progress-grid-search {
	flex: 1 1 300px;
	min-width: 260px;
}

.progress-grid-filters > button {
	flex: 0 0 auto;
}

.progress-control {
	position: relative;
}

.progress-grid-search {
	min-width: 0;
}

.progress-grid-meta {
	gap: 8px;
}

.progress-kpi-tabs-wrapper {
	margin-top: 4px;
}

.progress-kpi-tabs-bar {
	display: flex;
	align-items: flex-end;
	gap: 2px;
	border-bottom: 0;
}

.progress-kpi-tab {
	display: inline-flex;
	flex-direction: column;
	gap: 4px;
	padding: 8px 14px 10px;
	border: 1px solid transparent;
	border-bottom: none;
	border-radius: 7px 7px 0 0;
	color: inherit;
	text-decoration: none;
	line-height: 1;
	position: relative;
	margin-bottom: -1px;
	transition: background 120ms ease, border-color 120ms ease;
}

.progress-kpi-tab:hover {
	background: rgba(0, 0, 0, 0.03);
	border-color: rgba(0, 0, 0, 0.1);
}

.progress-kpi-tab.is-active {
	background: rgba(15, 76, 92, 0.12);
	border-color: transparent;
	color: #0f4c5c;
	z-index: 1;
	box-shadow: none;
}

.progress-kpi-tab.is-active .progress-kpi-tab-label,
.progress-kpi-tab.is-active .progress-kpi-tab-value,
.progress-kpi-tab.is-active .progress-kpi-tab-meta {
	color: #0f4c5c;
}

.progress-kpi-tab.is-active .progress-kpi-tab-value {
	color: #0f4c5c;
}

.progress-kpi-tab-label {
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #5f5e5a;
	white-space: nowrap;
}

.progress-kpi-tab-stat {
	display: flex;
	align-items: baseline;
	gap: 6px;
}

.progress-kpi-tab-value {
	font-size: 18px;
	font-weight: 700;
	color: #1a1a18;
}

.progress-kpi-tab-meta {
	font-size: 10px;
	color: #5f5e5a;
	white-space: nowrap;
}

.progress-kpi-rows {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 0 8px 10px;
	margin-left: auto;
	line-height: 1;
}

.progress-kpi-tab-panel {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 5px;
	padding: 8px 12px;
	border: 0;
	border-radius: 0 0 8px 8px;
	background: rgba(15, 76, 92, 0.12);
}

.progress-kpi-item {
	display: inline-flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	min-width: 82px;
	padding: 6px 8px;
	border: 0.5px solid rgba(0, 0, 0, 0.08);
	border-radius: 4px;
	background: #fff;
	font: inherit;
	line-height: 1;
	text-align: left;
}

.progress-kpi-item-label {
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: currentColor;
	white-space: nowrap;
}

.progress-kpi-item-meta {
	font-size: 10px;
	color: currentColor;
	white-space: nowrap;
}

.progress-kpi-item.badge-green {
	background: #eaf3de;
	border-color: rgba(39, 80, 10, 0.2);
	color: #27500a;
}

.progress-kpi-item.badge-amber {
	background: #faeeda;
	border-color: rgba(99, 56, 6, 0.2);
	color: #633806;
}

.progress-kpi-item.badge-red {
	background: #fcebeb;
	border-color: rgba(121, 31, 31, 0.2);
	color: #791f1f;
}

.progress-kpi-item.badge-grey {
	background: #ebebeb;
	border-color: rgba(95, 94, 90, 0.22);
	color: #5f5e5a;
}

.progress-kpi-item.badge-blue {
	background: #e6f1fb;
	border-color: rgba(12, 68, 124, 0.2);
	color: #0c447c;
}

.progress-kpi-item.badge-conflict {
	background: var(--color-background-danger);
	border-color: rgba(121, 31, 31, 0.2);
	color: var(--color-text-danger);
}

.progress-kpi-item-values {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	white-space: nowrap;
}

.progress-kpi-item .progress-grid-kpi-badge {
	background: rgba(255, 255, 255, 0.55);
	color: currentColor;
}

.progress-grid-grade-filter {
	cursor: pointer;
	transition: transform 120ms ease, box-shadow 120ms ease;
	transform-origin: center;
}

.progress-grid-grade-filter:hover {
	transform: scale(1.03);
}

.progress-grid-grade-filter.is-active {
	outline: 2px solid rgba(15, 76, 92, 0.35);
	outline-offset: 1px;
	box-shadow: 0 4px 12px rgba(15, 76, 92, 0.12);
}

.progress-inline-tip {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 12;
	max-width: 240px;
	padding: 8px 10px;
	border: 1px solid #57c84d;
	border-radius: 10px;
	background: #d7ffbf;
	box-shadow: 0 10px 28px rgba(87, 200, 77, 0.22);
	font-size: 12px;
	color: #14320f;
}

.progress-inline-tip::before {
	content: "";
	position: absolute;
	top: -6px;
	left: 14px;
	width: 10px;
	height: 10px;
	background: #d7ffbf;
	border-top: 1px solid #57c84d;
	border-left: 1px solid #57c84d;
	transform: rotate(45deg);
}

.progress-inline-tip-step {
	display: inline-block;
	margin-bottom: 4px;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #0f7a19;
}

.progress-grid-counter-label {
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #5f5e5a;
	white-space: nowrap;
}

.progress-grid-counter-value {
	font-size: 14px;
	font-weight: 700;
	color: #1a1a18;
	white-space: nowrap;
}

.progress-grid-counter-meta {
	font-size: 10px;
	color: #5f5e5a;
	white-space: nowrap;
}

.progress-grid-kpi-badge {
	font-size: 11px;
	padding: 2px 6px;
}

.progress-grid-legend {
	display: grid;
	gap: 8px;
	padding: 8px 0 2px;
}

.progress-grid-legend-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	flex-wrap: wrap;
}

.progress-grid-legend-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 14px;
	align-items: center;
}

.progress-grid-legend-label {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #5f5e5a;
}

.progress-grid-legend-group {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	padding: 6px 10px;
	border: 0.5px solid rgba(0, 0, 0, 0.06);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.72);
}

.progress-grid-legend-title {
	font-size: 11px;
	font-weight: 600;
	color: #5f5e5a;
	white-space: nowrap;
}

.progress-grid-legend-options {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.progress-grid-legend-badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 10px;
	padding: 2px 7px;
	border: none;
	cursor: pointer;
	transition: transform 120ms ease, box-shadow 120ms ease;
	transform-origin: center;
}

.progress-grid-legend-filter:hover {
	transform: scale(1.04);
}

.progress-grid-legend-filter.is-active {
	outline: 2px solid rgba(15, 76, 92, 0.35);
	outline-offset: 1px;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.progress-grid-flag-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 16px;
	padding: 1px 5px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.65);
	font-weight: 700;
	line-height: 1.2;
}

.progress-grid-frame {
	min-height: 0;
}

.progress-split-grid {
	display: grid;
	grid-template-columns: 220px minmax(0, 1fr);
	height: min(70vh, calc(100vh - 220px));
	min-height: 62vh;
	border: 0.5px solid rgba(0, 0, 0, 0.12);
	border-radius: 12px;
	overflow: hidden;
	background: #fff;
}

.progress-frozen-pane {
	overflow-y: auto;
	overflow-x: hidden;
	border-right: 1px solid rgba(0, 0, 0, 0.08);
	background: #fff;
}

.progress-grid-scroll {
	height: 100%;
	overflow: auto;
	position: relative;
	background: #fff;
}

.progress-matrix {
	width: max-content;
	min-width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	font-size: 13px;
}

.progress-matrix th,
.progress-matrix td {
	padding: 10px 12px;
	border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
	border-right: 0.5px solid rgba(0, 0, 0, 0.06);
	vertical-align: top;
	background: #fff;
}

.progress-matrix th {
	position: sticky;
	top: 0;
	z-index: 8;
	background: #f7fbfc;
	white-space: nowrap;
	box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}

.progress-matrix-frozen thead th {
	z-index: 10;
}

.progress-matrix tbody tr:nth-child(even) td,
.progress-matrix tbody tr:nth-child(even) th {
	background: #fbfdfd;
}

.progress-matrix tbody tr:hover td,
.progress-matrix tbody tr:hover th {
	background: #f0fbfc;
}

.progress-student {
	min-width: 220px;
	max-width: 220px;
}

.progress-student-link {
	display: flex;
	flex-direction: column;
	gap: 2px;
	color: inherit;
	text-decoration: none;
}

.progress-student-link-name {
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.progress-student-link-meta {
	font-size: 12px;
	color: inherit;
	opacity: 0.85;
}

.progress-student-link:hover .progress-student-link-name {
	text-decoration-thickness: 2px;
}

.btn.disabled,
.btn[aria-disabled="true"] {
	opacity: 0.5;
	pointer-events: none;
}

.progress-student.progress-student-grade-green {
	background: #eaf3de;
	color: #27500a;
}

.progress-student.progress-student-grade-amber {
	background: #faeeda;
	color: #633806;
}

.progress-student.progress-student-grade-red {
	background: #fcebeb;
	color: #791f1f;
}

.progress-student.progress-student-grade-grey {
	background: #ebebeb;
	color: #5f5e5a;
}

.progress-student.progress-student-grade-blue {
	background: #bfdbfe;
	color: #1e3a8a;
}

.progress-student[class*="progress-student-grade-"] .text-muted {
	color: inherit;
	opacity: 0.85;
}

.progress-matrix tbody tr.progress-row-grade-green:nth-child(n) td {
	background: #f0f8e8;
}

.progress-matrix tbody tr.progress-row-grade-amber:nth-child(n) td {
	background: #fff4dc;
}

.progress-matrix tbody tr.progress-row-grade-red:nth-child(n) td {
	background: #fff0f0;
}

.progress-matrix tbody tr.progress-row-grade-grey:nth-child(n) td {
	background: #f1f1f1;
}

.progress-matrix tbody tr.progress-row-grade-blue:nth-child(n) td {
	background: #eff6ff;
}

.progress-matrix tbody tr.progress-row-grade-green:hover td {
	background: #e5f2d6;
}

.progress-matrix tbody tr.progress-row-grade-amber:hover td {
	background: #ffedc2;
}

.progress-matrix tbody tr.progress-row-grade-red:hover td {
	background: #ffe2e2;
}

.progress-matrix tbody tr.progress-row-grade-grey:hover td {
	background: #e7e7e7;
}

.progress-matrix tbody tr.progress-row-grade-blue:hover td {
	background: #dbeafe;
}

.progress-matrix tbody tr.progress-row-grade-green:nth-child(n) .progress-student.progress-student-grade-green,
.progress-matrix tbody tr.progress-row-grade-green:hover .progress-student.progress-student-grade-green {
	background: #e1efcf;
	color: #27500a;
}

.progress-matrix tbody tr.progress-row-grade-amber:nth-child(n) .progress-student.progress-student-grade-amber,
.progress-matrix tbody tr.progress-row-grade-amber:hover .progress-student.progress-student-grade-amber {
	background: #ffe7b0;
	color: #633806;
}

.progress-matrix tbody tr.progress-row-grade-red:nth-child(n) .progress-student.progress-student-grade-red,
.progress-matrix tbody tr.progress-row-grade-red:hover .progress-student.progress-student-grade-red {
	background: #ffd6d6;
	color: #791f1f;
}

.progress-matrix tbody tr.progress-row-grade-grey:nth-child(n) .progress-student.progress-student-grade-grey,
.progress-matrix tbody tr.progress-row-grade-grey:hover .progress-student.progress-student-grade-grey {
	background: #e2e2e2;
	color: #5f5e5a;
}

.progress-matrix tbody tr.progress-row-grade-blue:nth-child(n) .progress-student.progress-student-grade-blue,
.progress-matrix tbody tr.progress-row-grade-blue:hover .progress-student.progress-student-grade-blue {
	background: #bfdbfe;
	color: #1e3a8a;
}

.progress-reg {
	left: 220px;
	min-width: 88px;
	max-width: 88px;
}

.progress-unit {
	left: 308px;
	min-width: 180px;
	max-width: 180px;
}

.progress-matrix-frozen {
	width: 100%;
	min-width: 100%;
}

.progress-matrix-frozen th,
.progress-matrix-frozen td {
	border-right: none;
}

.progress-matrix-main th:first-child,
.progress-matrix-main td:first-child {
	min-width: 88px;
	max-width: 88px;
}

.grade-ranking-page {
	width: calc(100vw - 48px);
	margin-left: calc(50% - 50vw + 24px);
	margin-right: calc(50% - 50vw + 24px);
}

.grade-ranking-toolbar {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
	gap: 18px;
	align-items: stretch;
	margin-bottom: 18px;
}

.grade-ranking-scope-card,
.grade-ranking-actions-card {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.grade-ranking-card-header h2 {
	margin: 0 0 4px;
	font-size: 16px;
}

.grade-ranking-card-header p {
	margin: 0;
	font-size: 12px;
}

.grade-ranking-filters {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 12px;
	align-items: end;
}

.grade-ranking-filters > div:first-child {
	min-width: min(260px, 100%);
}

.grade-ranking-filters > .btn {
	justify-self: start;
}

.grade-ranking-summary {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.grade-ranking-summary strong {
	display: block;
	font-size: 22px;
	line-height: 1;
}

.grade-ranking-stat {
	padding: 12px;
	border: 0.5px solid var(--color-border-secondary);
	border-radius: 8px;
	background: #f8fafb;
}

.grade-ranking-grade-change-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 32px;
	margin: 0;
	padding: 5px 9px;
	border: 0.5px solid var(--color-border-secondary);
	border-radius: 8px;
	background: #fff;
	color: #1a1a18;
	font-size: 12px;
	font-weight: 600;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	grid-column: 1 / -1;
}

.grade-ranking-grade-change-toggle input {
	width: 16px;
	height: 16px;
	min-height: 0;
	margin: 0;
	accent-color: #0f4c5c;
}

.grade-ranking-save-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	grid-column: 1 / -1;
}

.grade-ranking-board {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: clamp(300px, 28vw, 380px);
	gap: 14px;
	align-items: start;
	overflow-x: auto;
	overflow-y: hidden;
	padding-bottom: 12px;
	-webkit-overflow-scrolling: touch;
	scrollbar-gutter: stable;
}

.grade-ranking-group {
	min-width: 0;
	border: 0.5px solid rgba(0, 0, 0, 0.12);
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
}

.grade-ranking-group-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
	background: #f7fbfc;
}

.grade-ranking-group-header h2 {
	margin: 0 0 4px;
}

.grade-ranking-list {
	display: grid;
	gap: 8px;
	min-height: 72px;
	padding: 12px;
}

.grade-ranking-card {
	display: grid;
	grid-template-columns: 34px minmax(0, 1fr);
	align-items: stretch;
	border: 0.5px solid rgba(0, 0, 0, 0.14);
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.grade-ranking-card.is-dragging {
	opacity: 0.55;
}

.grade-ranking-card.has-grade-change-review {
	border-color: #b7791f;
	box-shadow: 0 0 0 2px rgba(183, 121, 31, 0.2);
}

.grade-ranking-handle {
	border: 0;
	border-right: 0.5px solid rgba(0, 0, 0, 0.1);
	background: rgba(255, 255, 255, 0.45);
	color: currentColor;
	cursor: grab;
	font: inherit;
	font-weight: 700;
}

.grade-ranking-handle:active {
	cursor: grabbing;
}

.grade-ranking-card-link {
	display: grid;
	grid-template-columns: 28px minmax(0, 1fr);
	gap: 10px;
	align-items: center;
	padding: 10px 12px;
	color: inherit;
	text-decoration: none;
	opacity: 1;
}

.grade-ranking-card-link:hover {
	background: rgba(255, 255, 255, 0.36);
}

.grade-ranking-position {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.72);
	font-size: 12px;
	font-weight: 700;
}

.grade-ranking-student {
	display: grid;
	gap: 4px;
	min-width: 0;
}

.grade-ranking-student-line {
	display: flex;
	align-items: baseline;
	gap: 7px;
	min-width: 0;
}

.grade-ranking-student-line strong {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.grade-ranking-class-group {
	font-size: 11px;
	opacity: 0.72;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.grade-ranking-score-breakdown {
	font-size: 11px;
	opacity: 0.72;
	white-space: nowrap;
	flex-shrink: 0;
}

.grade-ranking-card-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	min-width: 0;
}

.grade-ranking-change-indicator {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	padding: 2px 5px;
	border-radius: 4px;
	background: #fff3cd;
	color: #704c00;
	font-size: 10px;
	font-weight: 800;
	line-height: 1.2;
}

.grade-ranking-change-indicator.is-discussion {
	background: #fcebeb;
	color: #791f1f;
}

.grade-change-review-panel {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
	gap: 18px;
	align-items: start;
	margin-bottom: 16px;
	padding: 16px;
	border: 1px solid rgba(183, 121, 31, 0.55);
	border-radius: 8px;
	background: #fff9e8;
}

.grade-change-review-panel.is-discussion {
	border-color: rgba(185, 28, 28, 0.5);
	background: #fff1f1;
}

.grade-change-review-heading {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.grade-change-review-actions {
	display: grid;
	gap: 8px;
}

.grade-change-review-actions textarea {
	width: 100%;
	resize: vertical;
}

.marker-grade-lock-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(300px, 460px);
	gap: 18px;
	align-items: start;
}

@media (max-width: 800px) {
	.grade-change-review-panel {
		grid-template-columns: 1fr;
	}

	.marker-grade-lock-layout {
		grid-template-columns: 1fr;
	}
}

.grade-ranking-grade-initials {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	justify-content: flex-end;
	margin-left: auto;
	gap: 6px;
	font-size: 14px;
	font-weight: 800;
	line-height: 1;
	opacity: 1;
}

.grade-ranking-grade-initials span {
	min-width: 10px;
	text-align: center;
}

.grade-ranking-score {
	flex-shrink: 0;
	margin-left: 8px;
	padding: 1px 6px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.08);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.4;
	font-variant-numeric: tabular-nums;
}

.grade-ranking-card-green {
	background: #eaf3de;
	color: #27500a;
}

.grade-ranking-card-amber {
	background: #faeeda;
	color: #633806;
}

.grade-ranking-card-red {
	background: #fcebeb;
	color: #791f1f;
}

.grade-ranking-card-grey {
	background: #ebebeb;
	color: #5f5e5a;
}

.grade-ranking-card-blue {
	background: #e6f1fb;
	color: #0c447c;
}

.text-success {
	color: var(--color-text-success);
	font-size: 13px;
}

.text-danger {
	color: var(--color-text-danger);
	font-size: 13px;
}

@media (max-width: 960px) {
	.grade-ranking-page {
		width: 100%;
		margin-left: 0;
		margin-right: 0;
	}

	.grade-ranking-toolbar,
	.grade-ranking-filters {
		grid-template-columns: 1fr;
	}

	.grade-ranking-save-row {
		align-items: stretch;
		flex-direction: column;
	}
}

/* Bell / notification icon in nav */
.nav-bell {
  position: relative;
  display: flex;
  align-items: center;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  padding: 0 10px;
  transition: color 0.15s;
}
.nav-bell:hover { color: #fff; }
.nav-gear {
  display: flex;
  align-items: center;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  padding: 0 10px;
  transition: color 0.15s;
}
.nav-gear:hover { color: #fff; }
.nav-bell-badge {
  position: absolute;
  top: -2px;
  right: 2px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* Notifications page list */
.notification-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 0.5px solid var(--color-border-tertiary);
}
.notification-item:last-child { border-bottom: none; }
.notification-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  margin-top: 5px;
}
.notification-item--unread .notification-dot {
  background: #0e7490;
}
.notification-body { flex: 1; }
.notification-message {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--color-text-primary);
}
.notification-time {
  margin: 0;
  font-size: 12px;
}

/* Export job nav indicator */
.nav-export-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-right: 1px solid rgba(255,255,255,0.15);
}
.nav-export-pending {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: rgba(255,255,255,0.75);
}
.nav-export-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: rgba(255,255,255,0.9);
  border-radius: 50%;
  animation: nav-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes nav-spin { to { transform: rotate(360deg); } }
.nav-export-ready {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: #a3e635;
  text-decoration: none;
  white-space: nowrap;
}
.nav-export-ready:hover { color: #bef264; }
.nav-export-error {
  display: inline-block;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: #fca5a5;
  text-decoration: none;
}
.nav-export-error:hover { color: #fecaca; }
.nav-export-dismiss {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  line-height: 1;
}
.nav-export-dismiss:hover { color: rgba(255,255,255,0.8); }


/* ── iPad / tablet viewport fixes ──────────────────────────────────────── */

/* The assignments layout uses negative margins to escape the 960px container
   and go full-bleed. When the viewport is narrower than 960px the formula
   flips to positive margins and causes horizontal overflow. Reset it. */
@media (max-width: 960px) {
  .progress-grid-page {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .progress-grid-filters > div,
  .progress-grid-filters > button {
    flex: 1 1 100%;
  }

  .progress-kpi-tabs-bar {
    overflow-x: auto;
  }

  .progress-grid-scroll {
    min-height: 55vh;
  }

  .progress-split-grid {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .assignments-layout {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
    height: auto;
  }

  .assignments-main {
    height: auto;
  }

  .grid-wrapper {
    max-height: 55vh;
  }
}

/* Portrait iPad Air 11" is 820px — the existing 900px query handles the nav.
   These rules add what was missing: stacking the assignments sidebar and
   allowing the criteria table to scroll horizontally. */
@media (max-width: 900px) {
	.assignments-layout {
		grid-template-columns: 1fr;
	}

	.assignments-sidebar {
		position: static;
	}

	.brief-grade-layout-has-sidebar,
	.brief-grade-layout-has-sidebar.sidebar-expanded {
		grid-template-columns: 1fr;
	}

	.brief-grade-sidebar {
		position: static;
		order: -1;
		max-height: none;
		overflow-y: visible;
	}

	.brief-grade-sidebar-card {
		max-height: none;
		overflow-y: visible;
	}

	/* Criteria grading table is too wide for portrait — let it scroll */
	.card > table,
	.card > div > table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .container {
    margin: 16px auto;
  }
}

/* Touch-device improvements (pointer: coarse = touchscreen, e.g. iPad).
   Applied regardless of screen size so it covers iPad landscape too. */
@media (pointer: coarse) {
  /* Prevent Safari/iPadOS from auto-zooming into inputs on focus,
     which happens when font-size < 16px */
  input,
  select,
  textarea,
  .input-inline {
    font-size: 16px;
  }

  /* 44px is Apple's minimum recommended touch target */
  input,
  select {
    min-height: 44px;
  }

  .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .btn-small {
    min-height: 36px;
  }

  .grade-btn {
    min-height: 44px;
    padding: 10px 16px;
  }

  .grid-select {
    min-height: 44px;
  }

  .nav-link,
  .nav-trigger {
    min-height: 44px;
  }

  .nav-menu a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

.shared-page-loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(245, 241, 231, 0.72);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
  z-index: 2500;
}

.shared-page-loader.is-visible {
  opacity: 1;
  visibility: visible;
}

.shared-page-loader-card {
  width: min(360px, 100%);
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 24px 26px;
  border-radius: 18px;
  border: 1px solid rgba(82, 66, 37, 0.16);
  background: rgba(255, 252, 246, 0.96);
  box-shadow: 0 20px 48px rgba(50, 38, 19, 0.16);
  text-align: center;
}

.shared-page-loader-image {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.shared-page-loader-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1f1d19;
}

.shared-page-loader-copy {
  font-size: 0.92rem;
  line-height: 1.45;
  color: #5f5e5a;
}

.shared-page-loader-progress {
  width: 100%;
  margin-top: 4px;
  display: none;
  gap: 6px;
}

.shared-page-loader-progress.is-visible {
  display: grid;
}

.shared-page-loader-progress-track {
  position: relative;
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 76, 92, 0.12);
}

.shared-page-loader-progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f4c5c 0%, #3797a4 100%);
  transition: width 260ms ease;
}

.shared-page-loader-progress-status {
  font-size: 0.75rem;
  line-height: 1.3;
  color: #7a766d;
  letter-spacing: 0.01em;
}
