*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	background: var(--paper);
	color: var(--ink-950);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

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

button,
summary,
select,
label[for] {
	touch-action: manipulation;
}

a {
	color: var(--schedule);
}

img,
video {
	display: block;
	max-width: 100%;
}

h1,
h2,
h3,
p {
	margin-top: 0;
}

h1,
h2,
h3 {
	color: var(--ink-950);
	line-height: 1.15;
}

h1,
.display-type {
	font-family: var(--font-display);
}

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

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

.skip-link {
	position: fixed;
	top: var(--space-3);
	left: var(--space-3);
	z-index: 1000;
	transform: translateY(-180%);
	padding: 0.65rem 1rem;
	border-radius: var(--radius-md);
	background: var(--ink-950);
	color: var(--white);
	font-weight: 700;
	text-decoration: none;
	transition: transform var(--motion-fast) var(--ease-out);
}

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

:focus-visible {
	outline: 3px solid var(--schedule);
	outline-offset: 3px;
}

::selection {
	background: var(--schedule-soft);
	color: var(--ink-950);
}

.icon {
	display: inline-block;
	flex: 0 0 auto;
	vertical-align: -0.15em;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 0.7rem;
	color: var(--ink-950);
	font-weight: 700;
	letter-spacing: 0.055em;
	text-decoration: none;
}

.brand__mark {
	display: grid;
	grid-template-columns: repeat(3, 4px);
	align-items: end;
	gap: 3px;
	width: 18px;
	height: 22px;
}

.brand__mark span {
	display: block;
	border-radius: 2px 2px 0 0;
	background: var(--schedule);
}

.brand__mark span:nth-child(1) { height: 11px; }
.brand__mark span:nth-child(2) { height: 20px; background: var(--campus); }
.brand__mark span:nth-child(3) { height: 15px; }

.brand__name {
	font-size: 0.94rem;
}

.button {
	display: inline-flex;
	min-height: 44px;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	padding: 0.62rem 1rem;
	border: 1px solid transparent;
	border-radius: var(--radius-md);
	background: transparent;
	color: var(--ink-900);
	font-weight: 700;
	line-height: 1.15;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color var(--motion-fast) ease, border-color var(--motion-fast) ease, color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

.button:hover {
	text-decoration: none;
}

.button:active {
	filter: brightness(0.95);
}

.button--primary,
.button.primary {
	border-color: var(--schedule);
	background: var(--schedule);
	color: var(--white);
	box-shadow: 0 5px 14px rgba(47, 82, 178, 0.18);
}

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

.button--secondary,
.button.secondary,
.button.ghost {
	border-color: var(--line-strong);
	background: var(--surface);
	color: var(--ink-900);
	box-shadow: var(--shadow-xs);
}

.button--secondary:hover,
.button.secondary:hover,
.button.ghost:hover {
	border-color: var(--schedule);
	background: var(--surface-blue);
	color: var(--schedule-strong);
}

.button--quiet {
	color: var(--ink-700);
}

.button--quiet:hover {
	background: var(--surface-soft);
	color: var(--ink-950);
}

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

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

.button--danger-quiet {
	border-color: #efb3ad;
	background: var(--danger-soft);
	color: var(--danger-strong);
}

.button--danger-quiet:hover {
	border-color: var(--danger);
	background: #ffe2df;
}

.button.compact,
.button--compact {
	min-height: 40px;
	padding: 0.5rem 0.75rem;
	font-size: var(--text-sm);
}

.button:disabled,
.button[aria-disabled="true"] {
	cursor: not-allowed;
	opacity: 0.48;
	box-shadow: none;
}

.icon-button {
	display: inline-grid;
	width: 44px;
	height: 44px;
	place-items: center;
	padding: 0;
	border: 1px solid var(--line);
	border-radius: var(--radius-md);
	background: var(--surface);
	color: var(--ink-900);
	cursor: pointer;
}

.icon-button:hover {
	border-color: var(--schedule);
	color: var(--schedule);
}

.eyebrow {
	margin-bottom: var(--space-2);
	color: var(--schedule);
	font-size: var(--text-xs);
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.page-heading {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--space-6);
	margin-bottom: var(--space-6);
	padding-bottom: var(--space-5);
	border-bottom: 1px solid var(--line);
}

.page-heading h1 {
	margin: 0;
	font-size: var(--text-2xl);
	letter-spacing: -0.025em;
}

.page-heading__description {
	max-width: 720px;
	margin: var(--space-2) 0 0;
	color: var(--ink-600);
	font-size: var(--text-base);
}

.page-heading__actions {
	display: flex;
	flex: 0 0 auto;
	gap: var(--space-2);
}

.alert-stack {
	display: grid;
	gap: var(--space-3);
	margin-bottom: var(--space-5);
}

.alert-stack:empty {
	display: none;
}

.alert {
	display: grid;
	grid-template-columns: 24px minmax(0, 1fr) 36px;
	align-items: center;
	gap: var(--space-3);
	min-height: 52px;
	padding: 0.65rem 0.7rem 0.65rem 0.9rem;
	border: 1px solid;
	border-radius: var(--radius-lg);
	font-weight: 600;
}

.alert--danger,
.alert.error {
	border-color: #eeb5af;
	background: var(--danger-soft);
	color: var(--danger-strong);
}

.alert--success,
.alert.success {
	border-color: #a8d5cf;
	background: var(--campus-soft);
	color: var(--campus-strong);
}

.alert--warning {
	border-color: #e7c58f;
	background: var(--warning-soft);
	color: var(--warning);
}

.alert--info,
.alert--message {
	border-color: #b9c7ed;
	background: var(--surface-blue);
	color: var(--schedule-strong);
}

.alert__icon {
	display: grid;
	width: 24px;
	height: 24px;
	place-items: center;
	border: 1.5px solid currentColor;
	border-radius: 50%;
	font-family: var(--font-data);
	font-size: var(--text-xs);
	font-weight: 700;
}

.alert__close {
	display: grid;
	width: 36px;
	height: 36px;
	place-items: center;
	border: 0;
	border-radius: var(--radius-sm);
	background: transparent;
	color: currentColor;
	font-size: 1.3rem;
	cursor: pointer;
}

.alert__close:hover {
	background: rgba(20, 33, 61, 0.08);
}

.panel,
.academic-panel,
.batch-panel,
.setting-panel {
	margin-bottom: var(--space-5);
	border: 1px solid var(--line);
	border-radius: var(--radius-xl);
	background: var(--surface);
	box-shadow: var(--shadow-xs);
}

.panel__header,
.panel-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--space-4);
	margin: 0;
	padding: var(--space-5) var(--space-6);
	border-bottom: 1px solid var(--line);
}

.panel__header h2,
.panel-header h2 {
	margin: 0;
	font-size: var(--text-xl);
	font-weight: 700;
}

.panel__header p,
.panel-header p,
.panel-description {
	max-width: 780px;
	margin: var(--space-1) 0 0;
	color: var(--ink-600);
}

.panel__body,
.academic-panel > form,
.academic-panel > .table-wrap,
.academic-panel > .group-grid,
.academic-panel > .academic-empty,
.batch-panel > form,
.batch-panel > .table-wrap,
.batch-panel > .group-grid,
.batch-panel > .batch-empty,
.setting-panel > :not(.panel-header) {
	margin-left: var(--space-6);
	margin-right: var(--space-6);
}

.panel__body,
.academic-panel > form,
.batch-panel > form,
.setting-panel > :not(.panel-header):first-of-type {
	margin-top: var(--space-5);
}

.panel__body,
.academic-panel > form:last-child,
.academic-panel > .table-wrap:last-child,
.academic-panel > .group-grid:last-child,
.academic-panel > .academic-empty:last-child,
.batch-panel > form:last-child,
.batch-panel > .table-wrap:last-child,
.batch-panel > .group-grid:last-child,
.batch-panel > .batch-empty:last-child,
.setting-panel > :not(.panel-header):last-child {
	margin-bottom: var(--space-6);
}

.form-stack,
.academic-form,
.academic-filter,
.batch-form {
	display: grid;
	gap: var(--space-5);
}

.form-grid {
	display: grid;
	gap: var(--space-4) var(--space-6);
}

.form-grid.single { grid-template-columns: minmax(0, 1fr); }
.form-grid.dual { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.triple { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.field,
.setting-field,
.constraint-field,
.form-group {
	display: grid;
	align-content: start;
	gap: 0.4rem;
}

.field label,
.setting-field label,
.constraint-field label,
.form-label,
.field-label {
	color: var(--ink-900);
	font-size: var(--text-sm);
	font-weight: 700;
}

.required-mark {
	color: var(--danger);
}

.field-help,
.field small,
.setting-field small,
.constraint-field small {
	color: var(--ink-600);
	font-size: var(--text-sm);
}

.field small a,
.field-help a {
	color: var(--schedule-strong);
	font-weight: 700;
}

.field input,
.field select,
.field textarea,
.setting-field input,
.setting-field select,
.constraint-field input,
.constraint-field select,
.form-input,
.control {
	width: 100%;
	min-height: 46px;
	padding: 0.65rem 0.8rem;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-md);
	background: var(--surface);
	color: var(--ink-950);
	outline: 0;
	transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease, background-color var(--motion-fast) ease;
}

.searchable-select {
	position: relative;
	width: 100%;
}

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

.searchable-select__trigger {
	position: relative;
	width: 100%;
	min-height: 46px;
	padding: 0.65rem 2.5rem 0.65rem 0.8rem;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-md);
	background: var(--surface);
	color: var(--ink-500);
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.searchable-select__trigger::after {
	position: absolute;
	top: 50%;
	right: 0.9rem;
	width: 8px;
	height: 8px;
	transform: translateY(-70%) rotate(45deg);
	border-right: 2px solid var(--ink-500);
	border-bottom: 2px solid var(--ink-500);
	content: "";
}

.searchable-select__trigger.has-value {
	color: var(--ink-950);
}

.searchable-select__trigger:disabled {
	background: var(--surface-soft);
	color: var(--ink-500);
	cursor: not-allowed;
	opacity: 0.72;
}

.searchable-select__trigger:focus-visible,
.searchable-select__trigger[aria-expanded="true"] {
	border-color: var(--schedule);
	box-shadow: var(--focus);
	outline: 0;
}

.searchable-select__trigger[aria-invalid="true"] {
	border-color: var(--danger);
}

.searchable-select__panel {
	position: absolute;
	top: calc(100% + var(--space-2));
	right: 0;
	left: 0;
	z-index: var(--z-overlay);
	padding: var(--space-2);
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-lg);
	background: var(--surface);
	box-shadow: var(--shadow-lg);
}

.searchable-select__search {
	width: 100%;
	min-height: 44px;
	margin-bottom: var(--space-2);
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-md);
	background: var(--surface-soft);
	color: var(--ink-950);
	font: inherit;
}

.searchable-select__search:focus {
	border-color: var(--schedule);
	box-shadow: var(--focus);
	outline: 0;
}

.searchable-select__options {
	display: grid;
	max-height: 240px;
	gap: 2px;
	overflow-y: auto;
}

.searchable-select__option {
	min-height: 44px;
	padding: 0.6rem 0.75rem;
	border: 0;
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--ink-700);
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.searchable-select__option:hover,
.searchable-select__option:focus-visible,
.searchable-select__option[aria-selected="true"] {
	background: var(--schedule-soft);
	color: var(--schedule-strong);
	outline: 0;
}

.searchable-select__empty {
	margin: 0;
	padding: var(--space-3);
	color: var(--ink-600);
	font-size: var(--text-sm);
	text-align: center;
}

.searchable-select__validation {
	margin: var(--space-2) 0 0;
	color: var(--danger-strong);
	font-size: var(--text-sm);
	font-weight: 600;
}

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

.field input:hover,
.field select:hover,
.setting-field input:hover,
.setting-field select:hover,
.constraint-field input:hover,
.constraint-field select:hover,
.form-input:hover {
	border-color: var(--ink-500);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.setting-field input:focus,
.setting-field select:focus,
.constraint-field input:focus,
.constraint-field select:focus,
.form-input:focus {
	border-color: var(--schedule);
	box-shadow: var(--focus);
}

.field input::placeholder,
.form-input::placeholder {
	color: var(--ink-500);
}

select {
	appearance: none;
	padding-right: 2.5rem !important;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23526079' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") !important;
	background-position: right 0.75rem center !important;
	background-repeat: no-repeat !important;
}

input[type="checkbox"],
input[type="radio"] {
	width: 18px;
	height: 18px;
	accent-color: var(--schedule);
}

input[type="file"] {
	padding: 0.5rem;
}

input[type="file"]::file-selector-button {
	margin-right: var(--space-3);
	padding: 0.45rem 0.75rem;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-sm);
	background: var(--surface-soft);
	color: var(--ink-900);
	font-weight: 700;
	cursor: pointer;
}

.form-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-3);
}

.inline-form {
	display: inline-flex;
	margin: 0;
}

.checkbox-row,
.choice-row {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	min-height: 44px;
	color: var(--ink-900);
	font-weight: 600;
}

.inline-code,
.data-text {
	font-family: var(--font-data);
	font-size: 0.86em;
}

.inline-code {
	padding: 0.12rem 0.35rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--surface-soft);
}

.table-wrap {
	max-width: 100%;
	overflow-x: auto;
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
}

.data-table,
.academic-table,
.batch-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.94rem;
}

.data-table caption,
.academic-table caption,
.batch-table caption {
	padding: var(--space-3);
	color: var(--ink-600);
	text-align: left;
}

.data-table th,
.data-table td,
.academic-table th,
.academic-table td,
.batch-table th,
.batch-table td {
	padding: 0.78rem 0.9rem;
	border-bottom: 1px solid var(--line);
	vertical-align: middle;
	text-align: left;
}

.data-table thead th,
.academic-table thead th,
.batch-table thead th {
	background: var(--surface-soft);
	color: var(--ink-700);
	font-size: var(--text-xs);
	font-weight: 700;
	letter-spacing: 0.065em;
	text-transform: uppercase;
}

.data-table tbody tr,
.academic-table tbody tr,
.batch-table tbody tr {
	transition: background-color var(--motion-fast) ease;
}

.data-table tbody tr:hover,
.academic-table tbody tr:hover,
.batch-table tbody tr:hover {
	background: #f8faff;
}

.data-table tbody tr:last-child td,
.academic-table tbody tr:last-child td,
.batch-table tbody tr:last-child td {
	border-bottom: 0;
}

.select-cell {
	width: 48px;
	padding-right: 0.25rem !important;
	text-align: center !important;
}

.select-cell label {
	display: grid;
	width: 36px;
	height: 36px;
	place-items: center;
	cursor: pointer;
}

.actions-header,
.actions-cell {
	width: 108px;
	white-space: nowrap;
	text-align: right !important;
}

.actions-align-center {
	text-align: center !important;
}

.actions-cell.actions-align-center .text-link {
	position: relative;
	width: 100%;
	justify-content: center;
	padding-inline: 0;
}

.actions-cell.actions-align-center .text-link .icon {
	position: absolute;
	right: 0;
}

.row-actions {
	display: flex;
	justify-content: flex-end;
	gap: var(--space-2);
}

.text-link {
	display: inline-flex;
	min-height: 40px;
	align-items: center;
	gap: var(--space-2);
	padding: 0.35rem 0.5rem;
	border-radius: var(--radius-sm);
	color: var(--schedule);
	font-weight: 700;
	text-decoration: none;
}

.text-link:hover {
	background: var(--schedule-soft);
	color: var(--schedule-strong);
}

.bulk-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
	margin-bottom: var(--space-3);
	padding: var(--space-3) var(--space-4);
	border: 1px solid #b9c7ed;
	border-radius: var(--radius-lg);
	background: var(--surface-blue);
}

.bulk-toolbar__summary {
	display: flex;
	align-items: baseline;
	gap: var(--space-2);
	color: var(--ink-700);
}

.bulk-toolbar__count {
	color: var(--schedule-strong);
	font-family: var(--font-data);
	font-weight: 700;
}

.bulk-toolbar__actions {
	display: flex;
	gap: var(--space-2);
}

.empty-state,
.academic-empty,
.batch-empty,
.step-empty {
	display: grid;
	justify-items: start;
	gap: var(--space-2);
	margin: 0;
	padding: var(--space-6);
	border: 1px dashed var(--line-strong);
	border-radius: var(--radius-lg);
	background: #fafcff;
	color: var(--ink-600);
}

.empty-state strong {
	color: var(--ink-900);
	font-size: var(--text-lg);
}

.badge {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	min-height: 28px;
	padding: 0.25rem 0.55rem;
	border-radius: 999px;
	background: var(--surface-soft);
	color: var(--ink-700);
	font-size: var(--text-xs);
	font-weight: 700;
}

.badge--success { background: var(--campus-soft); color: var(--campus-strong); }
.badge--warning { background: var(--warning-soft); color: #744005; }
.badge--blue { background: var(--schedule-soft); color: var(--schedule-strong); }

.confirm-dialog {
	width: min(520px, calc(100% - 2rem));
	padding: 0;
	border: 0;
	border-radius: var(--radius-xl);
	background: var(--surface);
	color: var(--ink-950);
	box-shadow: var(--shadow-lg);
}

.confirm-dialog::backdrop {
	background: rgba(20, 33, 61, 0.58);
	backdrop-filter: blur(2px);
}

.confirm-dialog__body {
	display: grid;
	grid-template-columns: 44px minmax(0, 1fr);
	gap: var(--space-4);
	padding: var(--space-6);
}

.confirm-dialog__mark {
	display: grid;
	width: 44px;
	height: 44px;
	place-items: center;
	border-radius: 50%;
	background: var(--danger-soft);
	color: var(--danger);
	font-family: var(--font-data);
	font-weight: 700;
}

.confirm-dialog h2 {
	margin: 0 0 var(--space-2);
	font-size: 1.45rem;
}

.confirm-dialog p:not(.eyebrow) {
	margin-bottom: 0;
	color: var(--ink-600);
}

.confirm-dialog__items {
	max-height: 150px;
	margin: var(--space-4) 0 0;
	padding-left: var(--space-5);
	overflow-y: auto;
	color: var(--ink-700);
}

.confirm-dialog__actions {
	display: flex;
	justify-content: flex-end;
	gap: var(--space-3);
	padding: var(--space-4) var(--space-6);
	border-top: 1px solid var(--line);
	background: var(--surface-soft);
}

@media (max-width: 767px) {
	.page-heading {
		align-items: flex-start;
		flex-direction: column;
		margin-bottom: var(--space-5);
	}

	.page-heading__actions,
	.page-heading__actions .button {
		width: 100%;
	}

	.panel__header,
	.panel-header {
		align-items: stretch;
		flex-direction: column;
		padding: var(--space-4);
	}

	.panel__body,
	.academic-panel > form,
	.academic-panel > .table-wrap,
	.academic-panel > .group-grid,
	.academic-panel > .academic-empty,
	.batch-panel > form,
	.batch-panel > .table-wrap,
	.batch-panel > .group-grid,
	.batch-panel > .batch-empty,
	.setting-panel > :not(.panel-header) {
		margin-left: var(--space-4);
		margin-right: var(--space-4);
	}

	.form-grid.dual,
	.form-grid.triple {
		grid-template-columns: 1fr;
	}

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

	.bulk-toolbar__actions,
	.bulk-toolbar__actions .button {
		width: 100%;
	}

	.confirm-dialog__body {
		grid-template-columns: 1fr;
		padding: var(--space-5);
	}

	.confirm-dialog__actions {
		align-items: stretch;
		flex-direction: column-reverse;
	}
}

@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;
	}
}
