/*
 * The chrome WordPress used to provide.
 *
 * runtime/screens.php has referenced this file in four places since the
 * standalone was written, and the file never existed. Nothing caught it:
 * check-undefined looks at PHP symbols, and core-smoke asserts that a screen
 * renders substantially and without notices, which an unstyled screen does
 * perfectly well. It took somebody opening the demo on a phone and seeing the
 * navigation render as a bulleted list of blue links.
 *
 * Scope: ONLY the classes the standalone emits and the plugin does not. In
 * WordPress all of this comes from wp-admin, so commons.css never had a
 * reason to style it. Everything below is nested under .cm-standalone or a
 * standalone-only body class so it can never reach the plugin.
 *
 * Tokens come from commons.css, which publishes them at :root precisely so
 * surfaces outside .cm-root can use them.
 */

/* ─── Shared base ──────────────────────────────────────────────────── */

body.cm-standalone,
body.cm-login-body,
body.cm-public-body {
	margin: 0;
	background: var(--cm-ground, #f2f2f3);
	color: var(--cm-ink, #1d2327);
	font-family: var(--cm-body-font, "Barlow", system-ui, sans-serif);
	font-size: 16px;
	line-height: 1.55;
}

/* ─── The admin shell: sidebar and content ─────────────────────────── */

.cm-standalone .cm-shell {
	display: flex;
	align-items: stretch;
	min-height: 100vh;
}

.cm-standalone .cm-nav {
	flex: 0 0 236px;
	background: var(--cm-steel-800, #2c455d);
	color: #dbe6f1;
	display: flex;
	flex-direction: column;
	position: sticky;
	top: 0;
	align-self: flex-start;
	max-height: 100vh;
	overflow-y: auto;
}

.cm-standalone .cm-nav__bar {
	display: flex;
	align-items: center;
	gap: 10px;
	border-bottom: 1px solid rgba(255, 255, 255, .14);
}

.cm-standalone .cm-nav__brand {
	font-family: var(--cm-display-font, "Barlow Condensed", sans-serif);
	font-weight: 700;
	font-size: 21px;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: #fff;
	padding: 18px 18px 14px;
	flex: 1 1 auto;
	min-width: 0;
}

/* The list of categories. Each is a <details>: a heading that folds, and the
   screens inside it. */
.cm-standalone .cm-nav #cm-nav-list {
	flex: 1 1 auto;
	padding: 6px 0 8px;
}

.cm-standalone .cm-nav ul {
	list-style: none;
	margin: 0;
	padding: 0 0 6px;
}

.cm-standalone .cm-nav li { margin: 0; }

.cm-standalone .cm-nav__search { margin: 4px 14px 10px; }

.cm-standalone .cm-nav__search input {
	width: 100%;
	box-sizing: border-box;
	padding: 7px 10px;
	background: rgba(255, 255, 255, .10);
	color: #fff;
	border: 1px solid rgba(255, 255, 255, .22);
	border-radius: 0;
	font: inherit;
	font-size: 14px;
}

.cm-standalone .cm-nav__search input::placeholder { color: #a9c3dc; }

.cm-standalone .cm-nav__campus { margin: 4px 14px 10px; }

.cm-standalone .cm-nav__campus select {
	width: 100%;
	box-sizing: border-box;
	padding: 7px 10px;
	background: rgba(255, 255, 255, .10);
	color: #fff;
	border: 1px solid rgba(255, 255, 255, .22);
	border-radius: 0;
	font: inherit;
	font-size: 14px;
}

.cm-standalone .cm-nav__campus select option { color: #1d2327; }

.cm-standalone .cm-nav__group > summary,
.cm-standalone .cm-nav__single {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 10px 18px;
	color: #fff;
	font-family: var(--cm-display-font, "Barlow Condensed", sans-serif);
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .07em;
	text-transform: uppercase;
	cursor: pointer;
	list-style: none;
	border-left: 3px solid transparent;
}

.cm-standalone .cm-nav__group > summary::-webkit-details-marker { display: none; }

/* The fold marker: a chevron that turns, drawn rather than shipped. */
.cm-standalone .cm-nav__group > summary::after {
	content: "";
	order: 3;
	width: 7px;
	height: 7px;
	margin-left: 4px;
	border-right: 2px solid #a9c3dc;
	border-bottom: 2px solid #a9c3dc;
	transform: rotate(-45deg);
	transition: transform .15s;
}

.cm-standalone .cm-nav__group[open] > summary::after { transform: rotate(45deg); }

.cm-standalone .cm-nav__group > summary .cm-nav__count { margin-left: auto; }
.cm-standalone .cm-nav__group > summary:hover,
.cm-standalone .cm-nav__single:hover { background: rgba(255, 255, 255, .08); }

.cm-standalone .cm-nav__group > summary:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -2px;
}

/* A group whose screen is open says so even when you are looking at its
   heading rather than the screen. */
.cm-standalone .cm-nav__group[open] > summary { color: #fff; }

.cm-standalone .cm-nav__single.cm-nav--current {
	background: rgba(255, 255, 255, .13);
	border-left-color: var(--cm-steel, #4f7499);
}

.cm-standalone .cm-nav__group li a { padding-left: 36px; }

.cm-standalone .cm-nav a {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 9px 18px;
	color: #cfdced;
	text-decoration: none;
	font-size: 15px;
	border-left: 3px solid transparent;
}

.cm-standalone .cm-nav a:hover,
.cm-standalone .cm-nav a:focus {
	background: rgba(255, 255, 255, .08);
	color: #fff;
}

.cm-standalone .cm-nav a:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -2px;
}

/* The current page. The class sits on the li, not the link. */
.cm-standalone .cm-nav .cm-nav--current > a {
	background: rgba(255, 255, 255, .13);
	color: #fff;
	font-weight: 600;
	border-left-color: var(--cm-steel, #4f7499);
}

/* Counts. The plain one is informational, the bad one is blocking, and they
   must not rely on color alone to tell them apart: the bad one is also
   heavier and squarer. */
.cm-standalone .cm-nav__count {
	margin-left: auto;
	min-width: 20px;
	padding: 1px 6px;
	text-align: center;
	font-family: var(--cm-display-font, "Barlow Condensed", sans-serif);
	font-weight: 600;
	font-size: 13px;
	line-height: 1.5;
	background: rgba(255, 255, 255, .18);
	color: #fff;
	border-radius: 0;
}

/* On the current item the badge's translucent white stacked on the item's,
   and white on the result was 4.4:1. Solid steel under it reads 10:1. */
.cm-standalone .cm-nav .cm-nav--current .cm-nav__count:not(.cm-nav__count--bad) {
	background: #2c455d;
}

.cm-standalone .cm-nav__count--bad {
	background: #c0392b;
	color: #fff;
	font-weight: 700;
}

.cm-standalone .cm-nav__foot {
	border-top: 1px solid rgba(255, 255, 255, .14);
	padding: 12px 18px 16px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.cm-standalone .cm-nav__foot a {
	color: #a9c3dc;
	font-size: 14px;
	text-decoration: underline;
}

.cm-standalone .cm-nav__foot a:hover { color: #fff; }

.cm-standalone .cm-main {
	flex: 1 1 auto;
	min-width: 0;          /* so wide tables scroll instead of pushing the nav */
	padding: 22px 26px 64px;
	background: var(--cm-ground, #f2f2f3);
}

/*
 * Wide tables. The console has several, and on a narrow screen they were
 * running off the side with the last column cut in half. Any direct table
 * in the content area scrolls inside its own box instead.
 */
.cm-standalone .cm-main table {
	max-width: 100%;
}

@media (max-width: 900px) {
	.cm-standalone .cm-main table {
		display: block;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
	/* A table already inside a scrolling box that can take focus does not get a second, unfocusable one. */
	.cm-standalone .cm-main .cm-scroll table,
	.cm-standalone .cm-main .cm-scrollx table {
		display: table;
		overflow: visible;
	}
}

/* ─── Phone: the sidebar becomes a strip above the content ─────────── */

@media (max-width: 860px) {
	.cm-standalone .cm-shell {
		display: block;
	}

	.cm-standalone .cm-nav {
		position: static;
		max-height: none;
		flex: none;
		width: auto;
	}

	/*
	 * Capped, and scrolls inside itself, so a long menu cannot push the page
	 * the visitor came for out of reach. The categories are folded but the
	 * current one, which is why ten of them fit where forty-four links did
	 * not.
	 */
	.cm-standalone .cm-nav #cm-nav-list {
		max-height: 60vh;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	.cm-standalone .cm-nav__group li a { padding-left: 36px; }

	.cm-standalone .cm-nav__foot {
		flex-direction: row;
		gap: 16px;
		padding: 10px 18px 14px;
	}

	.cm-standalone .cm-main { padding: 16px 14px 64px; }
}

/* ─── Login ────────────────────────────────────────────────────────── */

body.cm-login-body {
	display: grid;
	place-items: center;
	min-height: 100vh;
	padding: 20px;
	box-sizing: border-box;
}

.cm-login {
	/* border-box, or 100% plus the padding and border is wider than a phone. */
	box-sizing: border-box;
	width: 100%;
	max-width: 400px;
	background: #fff;
	border: 1px solid var(--cm-line, #d4d4d7);
	padding: 28px 26px;
}

.cm-login h1 {
	font-family: var(--cm-display-font, "Barlow Condensed", sans-serif);
	font-size: 30px;
	line-height: 1.1;
	margin: 0 0 18px;
	text-transform: uppercase;
	letter-spacing: .03em;
}

.cm-login label {
	display: block;
	font-family: var(--cm-display-font, "Barlow Condensed", sans-serif);
	text-transform: uppercase;
	letter-spacing: .08em;
	font-size: 13px;
	font-weight: 600;
	color: var(--cm-steel-800, #2c455d);
	margin: 0 0 5px;
}

.cm-login input[type="email"],
.cm-login input[type="password"],
.cm-login input[type="text"] {
	width: 100%;
	box-sizing: border-box;
	font: inherit;
	padding: 10px 11px;
	border: 1px solid var(--cm-line, #d4d4d7);
	border-radius: 0;
	margin-bottom: 14px;
	background: #fff;
	color: var(--cm-ink, #1d2327);
}

.cm-login input:focus {
	outline: 3px solid var(--cm-steel, #4f7499);
	outline-offset: 1px;
}

.cm-login button,
.cm-login input[type="submit"] {
	font-family: var(--cm-display-font, "Barlow Condensed", sans-serif);
	text-transform: uppercase;
	letter-spacing: .08em;
	font-weight: 600;
	font-size: 16px;
	padding: 11px 22px;
	background: var(--cm-steel-800, #2c455d);
	color: #fff;
	border: 2px solid var(--cm-steel-800, #2c455d);
	border-radius: 0;
	cursor: pointer;
}

.cm-login button:hover { background: var(--cm-steel-deep, #416180); }

.cm-login__error {
	border-left: 5px solid #a8453a;
	background: #fdf3f2;
	color: #8d2f26;
	padding: 10px 12px;
	margin: 0 0 16px;
}

.cm-login__sso {
	margin-top: 18px;
	padding-top: 16px;
	border-top: 1px solid var(--cm-line, #d4d4d7);
	font-size: 15px;
}

/* Links in the console and on public pages. WordPress gives every admin
   link its own blue; the standalone had no rule, so links were the
   browser's #0000ee and visited ones purple, off the palette on every
   screen. The brand's deep blue reads 6.4:1 on white. */
/* :where() keeps this at the weight of a bare "a" rule, so every component
   that colors its own links (calendar chips, buttons, tabs) still wins. */
:where(.cm-standalone .cm-main, .cm-public-main) a {
	color: #416180;
}
:where(.cm-standalone .cm-main, .cm-public-main) a:hover {
	color: #2c455d;
}

/* ─── Public pages ─────────────────────────────────────────────────── */

.cm-public-header {
	background: var(--cm-steel-800, #2c455d);
	color: #fff;
	padding: 14px 20px;
}

.cm-public-header__brand {
	font-family: var(--cm-display-font, "Barlow Condensed", sans-serif);
	font-weight: 700;
	font-size: 22px;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: #fff;
	text-decoration: none;
}

/* The header's links had no rule of their own, so they took the browser's
   default blue on the navy bar: 1.06:1, readable by nobody. Light on navy,
   spaced as a row, with an underline that shows which one has focus. */
.cm-public-header {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px 24px;
}
.cm-public-header nav {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
}
.cm-public-header nav a {
	color: #f2f2f3;
	font-weight: 600;
	text-decoration: none;
	border-bottom: 2px solid transparent;
	padding: 2px 0;
}
.cm-public-header nav a:hover,
.cm-public-header nav a:focus-visible {
	border-bottom-color: #b5d9fd;
	outline: none;
}
.cm-public-header nav a[aria-current="page"] {
	border-bottom-color: #b5d9fd;
}

.cm-public-main {
	max-width: 1100px;
	margin: 0 auto;
	padding: 22px 20px 64px;
}

@media (max-width: 860px) {
	.cm-public-main { padding: 16px 14px 64px; }
}

/* ─── Installer and restore ────────────────────────────────────────── */

.cm-install {
	max-width: 620px;
	margin: 6vh auto;
	padding: 28px 26px;
	background: #fff;
	border: 1px solid var(--cm-line, #d4d4d7);
}

.cm-install h1 {
	font-family: var(--cm-display-font, "Barlow Condensed", sans-serif);
	font-size: 32px;
	line-height: 1.1;
	margin: 0 0 14px;
}

.cm-install label {
	display: block;
	font-weight: 600;
	margin: 14px 0 4px;
}

.cm-install input,
.cm-install select {
	width: 100%;
	box-sizing: border-box;
	font: inherit;
	padding: 10px 11px;
	border: 1px solid var(--cm-line, #d4d4d7);
	border-radius: 0;
}

.cm-restore {
	border: 2px solid var(--cm-warn, #8a6516);
	background: #fdf8ec;
	padding: 16px 18px;
	margin: 18px 0;
}

/* ─── The phone menu ───────────────────────────────────────────────── */

.cm-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/*
 * The button is revealed by standalone-admin.js and hidden again above the
 * breakpoint. Without the script it never appears and the list stays open,
 * which is a working navigation rather than a dead control.
 */
.cm-standalone .cm-nav__toggle {
	display: none;
	align-items: center;
	gap: 9px;
	margin: 0 14px 0 0;
	padding: 9px 12px;
	background: rgba(255, 255, 255, .10);
	color: #fff;
	border: 1px solid rgba(255, 255, 255, .28);
	border-radius: 0;
	font-family: var(--cm-display-font, "Barlow Condensed", sans-serif);
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	cursor: pointer;
}

.cm-standalone .cm-nav__toggle:hover { background: rgba(255, 255, 255, .18); }

.cm-standalone .cm-nav__toggle:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* Three bars, drawn rather than shipped as an icon font or an image. */
.cm-standalone .cm-nav__burger,
.cm-standalone .cm-nav__burger::before,
.cm-standalone .cm-nav__burger::after {
	display: block;
	width: 18px;
	height: 2px;
	background: currentColor;
	content: "";
}

.cm-standalone .cm-nav__burger {
	position: relative;
}

.cm-standalone .cm-nav__burger::before { position: absolute; top: -6px; }
.cm-standalone .cm-nav__burger::after  { position: absolute; top: 6px; }

/* Open: the bars become a cross, so the control says what it will do next. */
.cm-standalone .cm-nav--open .cm-nav__toggle .cm-nav__burger {
	background: transparent;
}
.cm-standalone .cm-nav--open .cm-nav__toggle .cm-nav__burger::before {
	top: 0;
	transform: rotate(45deg);
}
.cm-standalone .cm-nav--open .cm-nav__toggle .cm-nav__burger::after {
	top: 0;
	transform: rotate(-45deg);
}

/* The count on the button keeps the badge shape it has in the list. */
.cm-standalone .cm-nav__toggle .cm-nav__count {
	margin-left: 2px;
}

@media (max-width: 860px) {
	.cm-standalone .cm-nav__toggle { display: flex; }

	/*
	 * Shut by default once the script has said it can be. The cap and the
	 * inner scroll stay for the open state, so a long list still cannot push
	 * the page out of reach.
	 */
	.cm-standalone .cm-nav--collapsible #cm-nav-list,
	.cm-standalone .cm-nav--collapsible .cm-nav__foot {
		display: none;
	}

	.cm-standalone .cm-nav--collapsible.cm-nav--open #cm-nav-list {
		display: block;
	}

	.cm-standalone .cm-nav--collapsible.cm-nav--open .cm-nav__foot {
		display: flex;
	}
}

@media (min-width: 861px) {
	/* The full height of the screen, not the height of its list: a short
	   list left grey under the navy column on every tall page. */
	.cm-standalone .cm-nav { height: 100vh; }
	/* Never on a desktop, whatever the script did. */
	.cm-standalone .cm-nav__toggle { display: none; }
	.cm-standalone .cm-nav--collapsible #cm-nav-list,
	.cm-standalone .cm-nav--collapsible .cm-nav__foot { display: flex; }
	.cm-standalone .cm-nav--collapsible #cm-nav-list { display: block; }
}

/* ─── The defaults WordPress's own admin stylesheet supplies ──────────
 *
 * The plugin's stylesheet was written on top of wp-admin's: it sets an
 * input's border colour and radius and trusts that something already set the
 * border's width and style, the padding and the font. On the standalone
 * nothing had, so every input fell back to the browser's two-pixel inset
 * border (the "half outline" on every field), text areas came out in
 * monospace, settings-row labels sat centred against the field and its help
 * text instead of level with the field's top, a button that was a link was a
 * bare underlined word, and a checkbox row's label came out a size larger
 * than the rest. These are WordPress's values, at zero specificity, so the
 * plugin's own rules still win wherever they speak.
 */
:where(.cm-standalone .cm-main) :where(
	input[type=text], input[type=email], input[type=url], input[type=password],
	input[type=number], input[type=search], input[type=tel], input[type=date],
	input[type=time], input[type=datetime-local], select, textarea
) {
	box-sizing: border-box;
	font-family: inherit;
	font-size: 14px;
	line-height: 2;
	min-height: 30px;
	padding: 0 8px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	background-color: #fff;
	color: #2c3338;
	max-width: 100%;
}
:where(.cm-standalone .cm-main) textarea {
	line-height: 1.5;
	padding: 6px 8px;
	overflow: auto;
}
:where(.cm-standalone .cm-main) select {
	padding-right: 24px;
}
:where(.cm-standalone .cm-main) :where(input[type=checkbox], input[type=radio]) {
	width: 16px;
	height: 16px;
	margin: 0 6px 0 0;
	vertical-align: -3px;
	accent-color: #416180;
}
:where(.cm-standalone .cm-main) .regular-text { width: 25em; }
:where(.cm-standalone .cm-main) .small-text { width: 6em; }
:where(.cm-standalone .cm-main) .large-text { width: 99%; }
:where(.cm-standalone .cm-main) .code,
:where(.cm-standalone .cm-main) code { font-family: Consolas, Monaco, monospace; }

/* Settings rows: label level with the top of its field, in one size. */
:where(.cm-standalone .cm-main) .form-table {
	border-collapse: collapse;
	width: 100%;
	margin-top: .5em;
	clear: both;
}
:where(.cm-standalone .cm-main) .form-table th {
	width: 200px;
	padding: 20px 10px 20px 0;
	vertical-align: top;
	text-align: left;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	color: #1d2327;
}
:where(.cm-standalone .cm-main) .form-table td {
	padding: 15px 10px;
	vertical-align: middle;
	line-height: 1.4;
	font-size: 14px;
}
:where(.cm-standalone .cm-main) .form-table td > p:first-child { margin-top: 0; }
:where(.cm-standalone .cm-main) .form-table label { font-size: 14px; }
@media (max-width: 782px) {
	:where(.cm-standalone .cm-main) .form-table th,
	:where(.cm-standalone .cm-main) .form-table td {
		display: block;
		width: auto;
		padding: 10px 0 0;
	}
	:where(.cm-standalone .cm-main) .form-table td { padding-bottom: 12px; }
	:where(.cm-standalone .cm-main) .regular-text { width: 100%; }
}

/* A button is a box whether it is a <button> or a link. */
:where(.cm-standalone .cm-main) :where(.button, a.button) {
	display: inline-block;
	box-sizing: border-box;
	min-height: 30px;
	margin: 0;
	padding: 0 12px;
	border: 1px solid #c3c4c7;
	border-radius: 3px;
	font-family: inherit;
	font-size: 13px;
	line-height: 2.15;
	text-decoration: none;
	white-space: nowrap;
	vertical-align: top;
	cursor: pointer;
}
/* wp-admin greys its own disabled buttons; this runtime has to say so
   itself. Until a job could be full of files there was no disabled button
   on these screens, and "Attach it" at the cap looked exactly like a live
   one. */
:where(.cm-standalone .cm-main) :where(.button, a.button):disabled {
	opacity: .55;
	cursor: not-allowed;
}

:where(.cm-standalone .cm-main) .button-small {
	min-height: 26px;
	padding: 0 8px;
	line-height: 2.18;
	font-size: 11px;
}
:where(.cm-standalone .cm-main) p.submit { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
:where(.cm-standalone .cm-main) .description { font-size: 13px; }

/* Who is signed in, at the foot of the menu. */
.cm-standalone .cm-nav__who { color: #dbe6f1; font-size: 13px; font-weight: 600; }
.cm-login__forgot { font-size: 14px; margin-top: 4px; }

/* The school logo beside the name in the menu and the public header. */
.cm-standalone .cm-nav__logo { height: 28px; width: auto; max-width: 120px; object-fit: contain; vertical-align: middle; margin-inline-end: 10px; }
.cm-public-header__logo { height: 32px; width: auto; max-width: 140px; object-fit: contain; vertical-align: middle; margin-inline-end: 10px; }
