/* ExamResults Manager – public forms & result card (theme-neutral baseline). */
.erm-app {
	--erm-primary: var(--er-primary, #0b4a7a);
	--erm-secondary: var(--er-secondary, #f2a900);
	--erm-border: #d5dde6;
	--erm-muted: #5b6776;
	--erm-bg: #fff;
	--erm-soft: #f3f6f9;
	--erm-pass: #157a3c;
	--erm-fail: #b91c1c;
	font-size: 15px;
	line-height: 1.5;
	color: #1f2933;
	margin: 0 0 2rem;
}
.erm-app *, .erm-app *::before, .erm-app *::after { box-sizing: border-box; }
.erm-form {
	background: var(--erm-bg);
	border: 1px solid var(--erm-border);
	border-top: 4px solid var(--erm-primary);
	border-radius: 6px;
	padding: 1.25rem 1.25rem 1rem;
	box-shadow: 0 2px 10px rgba(15, 30, 50, .06);
}
.erm-form-head { margin-bottom: 1rem; }
.erm-form-title { margin: 0 0 .25rem; font-size: 1.3rem; color: var(--erm-primary); }
.erm-form-intro { margin: 0; color: var(--erm-muted); font-size: .93rem; }
.erm-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: .9rem 1rem;
	align-items: start;
}
.erm-field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; color: #27313d; }
.erm-field label small { font-weight: 400; color: var(--erm-muted); }
.erm-req { color: var(--erm-fail); }
.erm-field input[type="text"], .erm-field select {
	width: 100%;
	height: 42px;
	padding: 0 .75rem;
	border: 1px solid #b9c4d0;
	border-radius: 4px;
	background: #fff;
	font: inherit;
	color: inherit;
}
.erm-field select:disabled { background: #eef1f4; color: #8a96a3; }
.erm-field input:focus, .erm-field select:focus {
	outline: none;
	border-color: var(--erm-primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--erm-primary) 22%, transparent);
}
.erm-has-error input, .erm-has-error select { border-color: var(--erm-fail); }
.erm-error { display: block; min-height: 1em; color: var(--erm-fail); font-size: .8rem; margin-top: .2rem; }
.erm-field-submit { align-self: end; padding-bottom: 1.2em; }
.erm-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
	height: 42px; padding: 0 1.25rem;
	border: 1px solid transparent; border-radius: 4px;
	font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
	transition: background .15s, box-shadow .15s;
}
.erm-btn-primary { background: var(--erm-primary); color: #fff; width: 100%; }
.erm-actions .erm-btn-primary { width: auto; }
.erm-btn-primary:hover, .erm-btn-primary:focus { background: color-mix(in srgb, var(--erm-primary) 85%, #000); color: #fff; }
.erm-btn-secondary { background: var(--erm-secondary); color: #1d1d1d; }
.erm-btn-secondary:hover, .erm-btn-secondary:focus { background: color-mix(in srgb, var(--erm-secondary) 85%, #000); color: #111; }
.erm-btn-ghost { background: #fff; border-color: var(--erm-border); color: #27313d; }
.erm-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--erm-primary) 40%, transparent); outline-offset: 2px; }
.erm-btn[disabled] { opacity: .75; cursor: progress; }
.erm-spinner { display: none; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: erm-spin .7s linear infinite; }
.erm-busy .erm-spinner { display: inline-block; }
.erm-loading-options select { background-image: linear-gradient(90deg, #fff 0, #eef3f8 50%, #fff 100%); background-size: 200% 100%; animation: erm-shimmer 1s linear infinite; }
@keyframes erm-spin { to { transform: rotate(360deg); } }
@keyframes erm-shimmer { to { background-position: -200% 0; } }

.erm-notice { padding: .7rem .9rem; border-radius: 4px; margin: .75rem 0 0; font-size: .93rem; border-left: 4px solid; }
.erm-notice-info { background: #eef5fb; border-color: #3b82c4; color: #1d4e7a; }
.erm-notice-error { background: #fdeeee; border-color: var(--erm-fail); color: #8a1c1c; }
.erm-notice-warning { background: #fff7e6; border-color: #d99a00; color: #7a5400; }
.erm-form-message:empty { display: none; }

/* Result card */
.erm-output:empty { display: none; }
.erm-output { margin-top: 1.5rem; }
.erm-card {
	background: #fff;
	border: 1px solid var(--erm-border);
	border-radius: 6px;
	padding: 1.5rem;
	box-shadow: 0 4px 18px rgba(15, 30, 50, .08);
	outline: none;
}
.erm-card-head { display: flex; align-items: center; justify-content: center; gap: 1rem; text-align: center; padding-bottom: .75rem; border-bottom: 2px solid var(--erm-primary); }
.erm-card-logo { width: 72px; height: 72px; object-fit: contain; }
.erm-card-org h3 { margin: 0; font-size: 1.35rem; text-transform: uppercase; letter-spacing: .02em; color: var(--erm-primary); }
.erm-card-org p { margin: .1rem 0 0; color: #3c4855; }
.erm-card-exam { font-size: .9rem; color: var(--erm-muted) !important; }
.erm-card-title { margin: 1rem 0; padding: .55rem 1rem; background: var(--erm-primary); color: #fff; text-align: center; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border-radius: 3px; }
.erm-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 1rem; }
.erm-card table { width: 100%; border-collapse: collapse; font-size: .93rem; margin: 0; }
.erm-card th, .erm-card td { border: 1px solid var(--erm-border); padding: .5rem .65rem; text-align: left; vertical-align: middle; }
.erm-info th { width: 18%; background: var(--erm-soft); font-weight: 600; white-space: nowrap; }
.erm-marks thead th { background: var(--erm-primary); color: #fff; border-color: var(--erm-primary); text-align: center; white-space: nowrap; }
.erm-marks tbody tr:nth-child(even) td { background: #fafbfd; }
.erm-marks tfoot th, .erm-marks tfoot td { background: #e6ecf2; font-weight: 700; }
.erm-marks tfoot th { text-align: right; }
.erm-c { text-align: center !important; }
.erm-row-fail td { color: var(--erm-fail); }
.erm-badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: #e5e9ee; color: #333; }
.erm-badge-pass { background: #dcf3e4; color: var(--erm-pass); }
.erm-badge-fail { background: #fbe1e1; color: var(--erm-fail); }
.erm-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin-bottom: 1rem; }
.erm-summary > div { background: var(--erm-soft); border: 1px solid var(--erm-border); border-radius: 4px; padding: .6rem; text-align: center; }
.erm-summary span { display: block; font-size: .8rem; color: var(--erm-muted); text-transform: uppercase; letter-spacing: .04em; }
.erm-summary strong { display: block; font-size: 1.2rem; margin-top: .15rem; }
.erm-status-pass strong { color: var(--erm-pass); }
.erm-status-fail strong, .erm-status-absent strong, .erm-status-withheld strong, .erm-status-cancelled strong { color: var(--erm-fail); }
.erm-remarks { margin: 0 0 1rem; }
.erm-card-foot { border-top: 1px dashed var(--erm-border); padding-top: .75rem; }
.erm-card-sign { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; font-size: .88rem; }
.erm-signatory { min-width: 200px; text-align: center; border-top: 1px solid #555; padding-top: .25rem; margin-top: 2.2rem; font-weight: 600; }
.erm-card-note { margin: 0; font-size: .8rem; color: var(--erm-muted); font-style: italic; text-align: center; }
.erm-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: 1rem; }
.erm-pos-heading { margin: 1.2rem 0 .5rem; font-size: 1.05rem; color: var(--erm-primary); }
.erm-pos-heading small { font-weight: 400; color: var(--erm-muted); }
.erm-medal { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: #e5e9ee; font-weight: 700; }
.erm-pos-1 .erm-medal { background: #f6d365; color: #5a4200; }
.erm-pos-2 .erm-medal { background: #d9dee4; color: #333; }
.erm-pos-3 .erm-medal { background: #e7b98a; color: #4d2b07; }

@media (max-width: 640px) {
	.erm-form, .erm-card { padding: 1rem; }
	.erm-summary { grid-template-columns: repeat(2, 1fr); }
	.erm-info, .erm-info tbody, .erm-info tr, .erm-info th, .erm-info td { display: block; width: 100%; }
	.erm-info tr { display: grid; grid-template-columns: 40% 60%; }
	.erm-info td[colspan="2"]:empty { display: none; }
	.erm-info td[colspan="3"] { grid-column: span 1; }
	.erm-card-head { flex-direction: column; }
	.erm-info th { white-space: normal; }
	.erm-marks th, .erm-marks td { padding: .4rem .35rem; font-size: .84rem; }
	.erm-marks thead th { white-space: normal; }
	.erm-actions .erm-btn { flex: 1 1 100%; }
}

/* Print only the result card when "Print Result" is used. */
@media print {
	@page { size: A4; margin: 12mm; }
	body.erm-printing * { visibility: hidden !important; }
	body.erm-printing .erm-print-scope .erm-print-target,
	body.erm-printing .erm-print-scope .erm-print-target * { visibility: visible !important; }
	body.erm-printing .erm-print-scope .erm-print-target { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; border: 2px solid var(--erm-primary); }
	.erm-actions, .erm-form { display: none !important; }
	.erm-card { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
	.erm-info, .erm-info tbody { display: table-row-group; }
	.erm-info { display: table; }
	.erm-info tr { display: table-row; }
	.erm-info th, .erm-info td { display: table-cell; width: auto; }
	.erm-summary { grid-template-columns: repeat(4, 1fr); }
	.erm-table-wrap { overflow: visible; }
}
